From effce1acff5b2eb11ce4058beae2038220a4b6d7 Mon Sep 17 00:00:00 2001 From: robertl Date: Sat, 21 Jul 2007 03:54:51 +0000 Subject: [PATCH] Add a (currently unused) subset of pilot-link for file handling of PDB files. --- Makefile.in | 4 +- configure | 4891 ++++++++++++++++++++++-------------- configure.in | 2 + pilot-link/README.gpsbabel | 6 + pilot-link/pi-args.h | 36 + pilot-link/pi-buffer.c | 118 + pilot-link/pi-buffer.h | 143 ++ pilot-link/pi-debug.h | 101 + pilot-link/pi-dlp.h | 1856 ++++++++++++++ pilot-link/pi-error.h | 95 + pilot-link/pi-file.c | 1534 +++++++++++ pilot-link/pi-file.h | 435 ++++ pilot-link/pi-macros.h | 290 +++ pilot-link/pi-source.h | 0 14 files changed, 7620 insertions(+), 1891 deletions(-) create mode 100644 pilot-link/README.gpsbabel create mode 100644 pilot-link/pi-args.h create mode 100644 pilot-link/pi-buffer.c create mode 100644 pilot-link/pi-buffer.h create mode 100644 pilot-link/pi-debug.h create mode 100644 pilot-link/pi-dlp.h create mode 100644 pilot-link/pi-error.h create mode 100644 pilot-link/pi-file.c create mode 100644 pilot-link/pi-file.h create mode 100644 pilot-link/pi-macros.h create mode 100644 pilot-link/pi-source.h diff --git a/Makefile.in b/Makefile.in index 258f8090e..b62d8d666 100644 --- a/Makefile.in +++ b/Makefile.in @@ -73,7 +73,7 @@ JEEPS=jeeps/gpsapp.o jeeps/gpscom.o \ # jeeps/gpsfmt.o jeeps/gpsinput.o jeeps/gpsproj.o -COLDSYNC=coldsync/util.o coldsync/pdb.o +@PALM_DB_CMT@PALM_DB=coldsync/util.o coldsync/pdb.o # pilot-link/pi-file.o pilot-link/pi-buffer.o SHAPE=shapelib/shpopen.o shapelib/dbfopen.o @@ -86,7 +86,7 @@ LIBOBJS = queue.o route.o waypt.o filter_vecs.o util.o vecs.o mkshort.o \ uuid.o formspec.o xmltag.o cet.o cet_util.o fatal.o rgbcolors.o \ xhtmlent.o inifile.o garmin_fs.o gbsleep.o units.o @GBSER@ gbser.o \ gbfile.o \ - $(COLDSYNC) $(GARMIN) $(JEEPS) $(SHAPE) @ZLIB@ $(FMTS) $(FILTERS) + $(PALM_DB) $(GARMIN) $(JEEPS) $(SHAPE) @ZLIB@ $(FMTS) $(FILTERS) OBJS = main.o globals.o $(LIBOBJS) @FILEINFO@ .c.o: diff --git a/configure b/configure index e46259997..6d8898eea 100755 --- a/configure +++ b/configure @@ -1,27 +1,56 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for GPSBabel 1.3.4. +# Generated by GNU Autoconf 2.61 for GPSBabel 1.3.4. # # Report bugs to . # -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh fi -DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then @@ -31,8 +60,43 @@ else fi +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + # Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done PS1='$ ' PS2='> ' PS4='+ ' @@ -46,18 +110,19 @@ do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else - $as_unset $as_var + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false @@ -65,157 +130,388 @@ fi # Name of the executable. -as_me=`$as_basename "$0" || +as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` +# CDPATH. +$as_unset CDPATH -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no fi + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in + case $as_dir in /*) - if ("$as_dir/$as_base" -c ' + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( as_lineno_1=$LINENO as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop - s,-$,, - s,^['$as_cr_digits']*\n,, + s/-\n.*// ' >$as_me.lineno && - chmod +x $as_me.lineno || + chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" # Exit status is that of the last command. exit } -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi -rm -f conf$$ conf$$.exe conf$$.file +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: @@ -224,7 +520,28 @@ else as_mkdir_p=false fi -as_executable_p="test -f" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -233,39 +550,27 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH +exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` -exec 6>&1 - # # Initializations. # ac_default_prefix=/usr/local +ac_clean_files= ac_config_libobj_dir=. +LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - # Identity of this package. PACKAGE_NAME='GPSBabel' PACKAGE_TARNAME='gpsbabel' @@ -273,8 +578,137 @@ PACKAGE_VERSION='1.3.4' PACKAGE_STRING='GPSBabel 1.3.4' PACKAGE_BUGREPORT='BUG-REPORT-ADDRESS' -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PACKAGE_RELEASE GBMAJOR GBMINOR GBMICRO build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE FILEINFO RC LIBUSBCONFIG USB_LIBS USB_CFLAGS OSJEEPS GBSER ZLIB EXPAT_LIB EFENCE_LIB GPSBABEL_DEBUG INSTALL_DEBUG DOCDIR LIBOBJS LTLIBOBJS' +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +PACKAGE_RELEASE +GBMAJOR +GBMINOR +GBMICRO +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +target +target_cpu +target_vendor +target_os +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +SET_MAKE + +CPP +GREP +EGREP +PALM_DB_CMT +FILEINFO +RC +LIBUSBCONFIG +USB_LIBS +USB_CFLAGS +OSJEEPS +GBSER +ZLIB +EXPAT_LIB +EFENCE_LIB +GPSBABEL_DEBUG +INSTALL_DEBUG +DOCDIR +LIBOBJS +LTLIBOBJS' ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + # Initialize some variables set by options. ac_init_help= @@ -301,34 +735,48 @@ x_libraries=NONE # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' +datarootdir='${prefix}/share' +datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' ac_prev= +ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" + eval $ac_prev=\$ac_option ac_prev= continue fi - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_option in + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; @@ -350,33 +798,45 @@ do --config-cache | -C) cache_file=config.cache ;; - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) + -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -403,6 +863,12 @@ do -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; @@ -427,13 +893,16 @@ do | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) + | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) @@ -498,6 +967,16 @@ do | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; @@ -550,24 +1029,20 @@ do -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. @@ -598,8 +1073,7 @@ Try \`$0 --help' for more information." >&2 expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" + eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) @@ -619,27 +1093,19 @@ if test -n "$ac_prev"; then { (exit 1); exit 1; }; } fi -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir do - eval ac_val=$`echo $ac_var` + eval ac_val=\$$ac_var case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' @@ -666,70 +1132,76 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then + if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } - fi fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done # # Report the --help message. @@ -758,9 +1230,6 @@ Configuration: -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] -_ACEOF - - cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] @@ -778,15 +1247,22 @@ Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/gpsbabel] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -827,128 +1303,96 @@ Some influential environment variables: CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF +ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. - ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue + test -d "$ac_dir" || continue ac_builddir=. -if test "$ac_dir" != .; then +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # We are building in place. ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } done fi -test -n "$ac_init_help" && exit 0 +test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF GPSBabel configure 1.3.4 -generated by GNU Autoconf 2.59 +generated by GNU Autoconf 2.61 -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF - exit 0 + exit fi -exec 5>config.log -cat >&5 <<_ACEOF +cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by GPSBabel $as_me 1.3.4, which was -generated by GNU Autoconf 2.59. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF +exec 5>>config.log { cat <<_ASUNAME ## --------- ## @@ -967,7 +1411,7 @@ uname -v = `(uname -v) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` @@ -981,6 +1425,7 @@ do test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done +IFS=$as_save_IFS } >&5 @@ -1002,7 +1447,6 @@ _ACEOF ac_configure_args= ac_configure_args0= ac_configure_args1= -ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do @@ -1013,7 +1457,7 @@ do -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in @@ -1035,9 +1479,7 @@ do -* ) ac_must_keep_next=true ;; esac fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " + ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done @@ -1048,8 +1490,8 @@ $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_ # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { @@ -1062,20 +1504,34 @@ trap 'exit_status=$? _ASBOX echo # The following way of writing the cache mishandles newlines in values, -{ +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} + esac | + sort +) echo cat <<\_ASBOX @@ -1086,22 +1542,28 @@ _ASBOX echo for ac_var in $ac_subst_vars do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## +## ------------------- ## +## File substitutions. ## +## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" done | sort echo fi @@ -1113,26 +1575,24 @@ _ASBOX ## ----------- ## _ASBOX echo - sed "/^$/d" confdefs.h | sort + cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status - ' 0 +' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h +rm -f -r conftest* confdefs.h # Predefined preprocessor variables. @@ -1163,14 +1623,17 @@ _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" fi -for ac_site_file in $CONFIG_SITE; do +shift +for ac_site_file +do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} @@ -1186,8 +1649,8 @@ if test -r "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; esac fi else @@ -1199,12 +1662,11 @@ fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do +for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 @@ -1229,8 +1691,7 @@ echo "$as_me: current value: $ac_new_val" >&2;} # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -1247,12 +1708,6 @@ echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start ov { (exit 1); exit 1; }; } fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - @@ -1277,6 +1732,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -1297,108 +1757,158 @@ GBMICRO=`echo $PACKAGE_VERSION | (IFS="."; read major minor micro; echo $micro)` # AC_CONFIG_SRCDIR([nmea.c]) - ac_config_headers="$ac_config_headers config.h" +ac_config_headers="$ac_config_headers config.h" ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break - elif test -f $ac_dir/install.sh; then + elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break - elif test -f $ac_dir/shtool; then + elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + # Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } -echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6; } if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } +fi fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -echo "$as_me:$LINENO: checking target system type" >&5 -echo $ECHO_N "checking target system type... $ECHO_C" >&6 +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6; } if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_target_alias=$target_alias -test "x$ac_cv_target_alias" = "x" && - ac_cv_target_alias=$ac_cv_host_alias -ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} { (exit 1); exit 1; }; } +fi fi -echo "$as_me:$LINENO: result: $ac_cv_target" >&5 -echo "${ECHO_T}$ac_cv_target" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 +echo "$as_me: error: invalid value of canonical target" >&2;} + { (exit 1); exit 1; }; };; +esac target=$ac_cv_target -target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. @@ -1417,8 +1927,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1431,32 +1941,34 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1469,36 +1981,51 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1511,74 +2038,34 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi + fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1592,7 +2079,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -1603,6 +2090,7 @@ do fi done done +IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. @@ -1620,22 +2108,23 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then - for ac_prog in cl + for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1648,36 +2137,38 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC - for ac_prog in cl + for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1690,29 +2181,45 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + test -n "$ac_ct_CC" && break done - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi fi fi @@ -1725,21 +2232,35 @@ See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 +echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } @@ -1764,47 +2285,77 @@ ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. break;; * ) break;; esac done +test "$ac_cv_exeext" = no && ac_cv_exeext= + else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -1816,19 +2367,21 @@ See \`config.log' for more details." >&2;} fi ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 -# Check the compiler produces executables we can run. If not, either +# Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -1847,22 +2400,27 @@ See \`config.log' for more details." >&2;} fi fi fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either +# Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then @@ -1873,9 +2431,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext break;; * ) break;; esac @@ -1889,14 +2446,14 @@ See \`config.log' for more details." >&2;} fi rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1916,14 +2473,20 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac @@ -1941,12 +2504,12 @@ fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1969,50 +2532,49 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_compiler_gnu=no + ac_compiler_gnu=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2028,38 +2590,118 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_prog_cc_g=no + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then @@ -2075,12 +2717,12 @@ else CFLAGS= fi fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_prog_cc_stdc=no + ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -2114,12 +2756,17 @@ static char *f (char * (*g) (char **, int), char **p, ...) /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get + as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std1. */ + that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -2134,205 +2781,57 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; return 0; } _ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break done -rm -f conftest.$ac_ext conftest.$ac_objext +rm -f conftest.$ac_ext CC=$ac_save_CC fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2352,8 +2851,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2375,7 +2874,7 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2394,64 +2893,702 @@ case $as_dir/ in ;; esac done +IFS=$as_save_IFS + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } +set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + SET_MAKE= +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.make <<\_ACEOF -all: - @echo 'ac_maketemp="$(MAKE)"' + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftest.make + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - SET_MAKE= -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - SET_MAKE="MAKE=${MAKE-make}" + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF +fi +done -echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 -echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } if test "${ac_cv_c_bigendian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -2468,7 +3605,8 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) bogus endian macros #endif @@ -2477,27 +3615,22 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -2520,40 +3653,36 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_c_bigendian=no + ac_cv_c_bigendian=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -# It does not; compile a test program. + # It does not; compile a test program. if test "$cross_compiling" = yes; then # try to guess the endianness by grepping values into an object file ac_cv_c_bigendian=unknown @@ -2563,11 +3692,11 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; -short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } -short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; -short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () @@ -2578,27 +3707,22 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes fi @@ -2614,8 +3738,10 @@ else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -2623,27 +3749,41 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +$ac_includes_default int main () { + /* Are we little or big endian? From Harbison&Steele. */ union { - long l; - char c[sizeof (long)]; + long int l; + char c[sizeof (long int)]; } u; u.l = 1; - exit (u.c[sizeof (long) - 1] == 1); + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -2656,13 +3796,16 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 -echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in yes) @@ -2683,8 +3826,8 @@ esac # Checks for libraries. -echo "$as_me:$LINENO: checking for cos in -lm" >&5 -echo $ECHO_N "checking for cos in -lm... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for cos in -lm" >&5 +echo $ECHO_N "checking for cos in -lm... $ECHO_C" >&6; } if test "${ac_cv_lib_m_cos+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -2697,56 +3840,53 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char cos (); int main () { -cos (); +return cos (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_m_cos=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_m_cos=no + ac_cv_lib_m_cos=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_m_cos" >&5 -echo "${ECHO_T}$ac_cv_lib_m_cos" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_cos" >&5 +echo "${ECHO_T}$ac_cv_lib_m_cos" >&6; } if test $ac_cv_lib_m_cos = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 @@ -2758,13 +3898,13 @@ fi -# Check whether --with-cet or --without-cet was given. +# Check whether --with-cet was given. if test "${with_cet+set}" = set; then - withval="$with_cet" - cet="$withval" + withval=$with_cet; cet="$withval" else cet="default" -fi; +fi + if test $GCC = yes; then CFLAGS="$CFLAGS -Wall" @@ -2785,107 +3925,109 @@ _ACEOF fi -echo "$as_me:$LINENO: checking whether to support shapefiles" >&5 -echo $ECHO_N "checking whether to support shapefiles... $ECHO_C" >&6 -# Check whether --enable-shapefile or --disable-shapefile was given. +{ echo "$as_me:$LINENO: checking whether to support shapefiles" >&5 +echo $ECHO_N "checking whether to support shapefiles... $ECHO_C" >&6; } +# Check whether --enable-shapefile was given. if test "${enable_shapefile+set}" = set; then - enableval="$enable_shapefile" - enable_shapefile="$enableval" + enableval=$enable_shapefile; enable_shapefile="$enableval" else enable_shapefile="yes" -fi; +fi + if test "$enable_shapefile" != "no" ; then cat >>confdefs.h <<\_ACEOF #define SHAPELIB_ENABLED 1 _ACEOF - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -echo "$as_me:$LINENO: checking whether to support Palm/OS pdb formats" >&5 -echo $ECHO_N "checking whether to support Palm/OS pdb formats... $ECHO_C" >&6 -# Check whether --enable-pdb or --disable-pdb was given. +{ echo "$as_me:$LINENO: checking whether to support Palm/OS pdb formats" >&5 +echo $ECHO_N "checking whether to support Palm/OS pdb formats... $ECHO_C" >&6; } +# Check whether --enable-pdb was given. if test "${enable_pdb+set}" = set; then - enableval="$enable_pdb" - enable_pdb="$enableval" + enableval=$enable_pdb; enable_pdb="$enableval" else enable_pdb="yes" -fi; +fi + if test "$enable_pdb" != "no" ; then cat >>confdefs.h <<\_ACEOF #define PDBFMTS_ENABLED 1 _ACEOF - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + PALM_DB_CMT=# + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -echo "$as_me:$LINENO: checking whether to support csv formats" >&5 -echo $ECHO_N "checking whether to support csv formats... $ECHO_C" >&6 -# Check whether --enable-csv or --disable-csv was given. + +{ echo "$as_me:$LINENO: checking whether to support csv formats" >&5 +echo $ECHO_N "checking whether to support csv formats... $ECHO_C" >&6; } +# Check whether --enable-csv was given. if test "${enable_csv+set}" = set; then - enableval="$enable_csv" - enable_csv="$enableval" + enableval=$enable_csv; enable_csv="$enableval" else enable_csv="yes" -fi; +fi + if test "$enable_csv" != "no" ; then cat >>confdefs.h <<\_ACEOF #define CSVFMTS_ENABLED 1 _ACEOF - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -echo "$as_me:$LINENO: checking whether to support filters" >&5 -echo $ECHO_N "checking whether to support filters... $ECHO_C" >&6 -# Check whether --enable-filters or --disable-filters was given. +{ echo "$as_me:$LINENO: checking whether to support filters" >&5 +echo $ECHO_N "checking whether to support filters... $ECHO_C" >&6; } +# Check whether --enable-filters was given. if test "${enable_filters+set}" = set; then - enableval="$enable_filters" - enable_filters="$enableval" + enableval=$enable_filters; enable_filters="$enableval" else enable_filters="yes" -fi; +fi + if test "$enable_filters" != "no" ; then cat >>confdefs.h <<\_ACEOF #define FILTERS_ENABLED 1 _ACEOF - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -echo "$as_me:$LINENO: checking whether to support zlib" >&5 -echo $ECHO_N "checking whether to support zlib... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking whether to support zlib" >&5 +echo $ECHO_N "checking whether to support zlib... $ECHO_C" >&6; } -# Check whether --with-zlib or --without-zlib was given. +# Check whether --with-zlib was given. if test "${with_zlib+set}" = set; then - withval="$with_zlib" + withval=$with_zlib; +fi -fi; case $with_zlib in "system") -echo "$as_me:$LINENO: checking for gzopen in -lz" >&5 -echo $ECHO_N "checking for gzopen in -lz... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for gzopen in -lz" >&5 +echo $ECHO_N "checking for gzopen in -lz... $ECHO_C" >&6; } if test "${ac_cv_lib_z_gzopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -2898,56 +4040,53 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char gzopen (); int main () { -gzopen (); +return gzopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_z_gzopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_z_gzopen=no + ac_cv_lib_z_gzopen=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzopen" >&5 -echo "${ECHO_T}$ac_cv_lib_z_gzopen" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzopen" >&5 +echo "${ECHO_T}$ac_cv_lib_z_gzopen" >&6; } if test $ac_cv_lib_z_gzopen = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 @@ -2964,12 +4103,12 @@ cat >>confdefs.h <<\_ACEOF #define ZLIB_INHIBITED 1 _ACEOF - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } ;; *) ZLIB="\$(ZLIB)" - echo "$as_me:$LINENO: result: using included version" >&5 -echo "${ECHO_T}using included version" >&6;; + { echo "$as_me:$LINENO: result: using included version" >&5 +echo "${ECHO_T}using included version" >&6; };; esac case "$target" in @@ -2994,8 +4133,8 @@ case "$target" in GBSER=gbser_win.o if test "$with_libusb" = no ; then - echo "$as_me:$LINENO: result: USB skipped" >&5 -echo "${ECHO_T}USB skipped" >&6 + { echo "$as_me:$LINENO: result: USB skipped" >&5 +echo "${ECHO_T}USB skipped" >&6; } OSJEEPS=jeeps/gpsusbstub.o else OSJEEPS=jeeps/gpsusbwin.o @@ -3004,17 +4143,17 @@ echo "${ECHO_T}USB skipped" >&6 ;; *) GBSER=gbser_posix.o - echo "$as_me:$LINENO: checking for libusb" >&5 -echo $ECHO_N "checking for libusb... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for libusb" >&5 +echo $ECHO_N "checking for libusb... $ECHO_C" >&6; } if test "$with_libusb" = no ; then - echo "$as_me:$LINENO: result: check not done" >&5 -echo "${ECHO_T}check not done" >&6 + { echo "$as_me:$LINENO: result: check not done" >&5 +echo "${ECHO_T}check not done" >&6; } OSJEEPS=jeeps/gpsusbstub.o else # Extract the first word of "libusb-config", so it can be a program name with args. set dummy libusb-config; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_LIBUSBCONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -3027,34 +4166,36 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIBUSBCONFIG="true" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS test -z "$ac_cv_prog_LIBUSBCONFIG" && ac_cv_prog_LIBUSBCONFIG="false" fi fi LIBUSBCONFIG=$ac_cv_prog_LIBUSBCONFIG if test -n "$LIBUSBCONFIG"; then - echo "$as_me:$LINENO: result: $LIBUSBCONFIG" >&5 -echo "${ECHO_T}$LIBUSBCONFIG" >&6 + { echo "$as_me:$LINENO: result: $LIBUSBCONFIG" >&5 +echo "${ECHO_T}$LIBUSBCONFIG" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + if test "$LIBUSBCONFIG" = true; then OLDFLAGS=$LDFLAGS OCFLAGS=$CFLAGS LDFLAGS="$LDFLAGS `libusb-config --libs`" CFLAGS="$OCFLAGS `libusb-config --cflags`" - echo "$as_me:$LINENO: checking for usb_interrupt_read in -lusb" >&5 -echo $ECHO_N "checking for usb_interrupt_read in -lusb... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for usb_interrupt_read in -lusb" >&5 +echo $ECHO_N "checking for usb_interrupt_read in -lusb... $ECHO_C" >&6; } if test "${ac_cv_lib_usb_usb_interrupt_read+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -3067,56 +4208,53 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char usb_interrupt_read (); int main () { -usb_interrupt_read (); +return usb_interrupt_read (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_usb_usb_interrupt_read=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_usb_usb_interrupt_read=no + ac_cv_lib_usb_usb_interrupt_read=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_usb_usb_interrupt_read" >&5 -echo "${ECHO_T}$ac_cv_lib_usb_usb_interrupt_read" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_lib_usb_usb_interrupt_read" >&5 +echo "${ECHO_T}$ac_cv_lib_usb_usb_interrupt_read" >&6; } if test $ac_cv_lib_usb_usb_interrupt_read = yes; then cat >>confdefs.h <<\_ACEOF @@ -3155,16 +4293,15 @@ esac -echo "$as_me:$LINENO: checking for random stuff to make you feel better" >&5 -echo $ECHO_N "checking for random stuff to make you feel better... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6 +{ echo "$as_me:$LINENO: checking for random stuff to make you feel better" >&5 +echo $ECHO_N "checking for random stuff to make you feel better... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6; } -# Check whether --with-expathdr or --without-expathdr was given. +# Check whether --with-expathdr was given. if test "${with_expathdr+set}" = set; then - withval="$with_expathdr" - xpathdr="$withval" + withval=$with_expathdr; xpathdr="$withval" else case "$target" in @@ -3182,19 +4319,19 @@ else esac -fi; +fi + if test "x-$xpathdr" != "x-" ; then CFLAGS="$CFLAGS -I$xpathdr" fi -echo "$as_me:$LINENO: checking for libexpat" >&5 -echo $ECHO_N "checking for libexpat... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for libexpat" >&5 +echo $ECHO_N "checking for libexpat... $ECHO_C" >&6; } -# Check whether --with-libexpat or --without-libexpat was given. +# Check whether --with-libexpat was given. if test "${with_libexpat+set}" = set; then - withval="$with_libexpat" - CFLAGS="$CFLAGS -L$withval" + withval=$with_libexpat; CFLAGS="$CFLAGS -L$withval" EXPAT_LIB="-L$withval -lexpat" else @@ -3228,12 +4365,13 @@ _ACEOF esac -fi; -echo "$as_me:$LINENO: result: $EXPAT_LIB" >&5 -echo "${ECHO_T}$EXPAT_LIB" >&6 +fi + +{ echo "$as_me:$LINENO: result: $EXPAT_LIB" >&5 +echo "${ECHO_T}$EXPAT_LIB" >&6; } -echo "$as_me:$LINENO: checking for XML_ParserCreate in -lexpat" >&5 -echo $ECHO_N "checking for XML_ParserCreate in -lexpat... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for XML_ParserCreate in -lexpat" >&5 +echo $ECHO_N "checking for XML_ParserCreate in -lexpat... $ECHO_C" >&6; } if test "${ac_cv_lib_expat_XML_ParserCreate+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -3246,56 +4384,53 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char XML_ParserCreate (); int main () { -XML_ParserCreate (); +return XML_ParserCreate (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_expat_XML_ParserCreate=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_expat_XML_ParserCreate=no + ac_cv_lib_expat_XML_ParserCreate=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_expat_XML_ParserCreate" >&5 -echo "${ECHO_T}$ac_cv_lib_expat_XML_ParserCreate" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_lib_expat_XML_ParserCreate" >&5 +echo "${ECHO_T}$ac_cv_lib_expat_XML_ParserCreate" >&6; } if test $ac_cv_lib_expat_XML_ParserCreate = yes; then cat >>confdefs.h <<\_ACEOF @@ -3307,33 +4442,33 @@ _ACEOF fi -echo "$as_me:$LINENO: checking for efence" >&5 -echo $ECHO_N "checking for efence... $ECHO_C" >&6 -# Check whether --enable-efence or --disable-efence was given. +{ echo "$as_me:$LINENO: checking for efence" >&5 +echo $ECHO_N "checking for efence... $ECHO_C" >&6; } +# Check whether --enable-efence was given. if test "${enable_efence+set}" = set; then - enableval="$enable_efence" - if test "$enable_efence" != "no" ; then + enableval=$enable_efence; if test "$enable_efence" != "no" ; then EFENCE_LIB=-lefence GPSBABEL_DEBUG=gpsbabel-debug INSTALL_DEBUG=install-debug fi -fi; +fi + -echo "$as_me:$LINENO: result: $EFENCE_LIB" >&5 -echo "${ECHO_T}$EFENCE_LIB" >&6 +{ echo "$as_me:$LINENO: result: $EFENCE_LIB" >&5 +echo "${ECHO_T}$EFENCE_LIB" >&6; } -echo "$as_me:$LINENO: checking for docdir" >&5 -echo $ECHO_N "checking for docdir... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for docdir" >&5 +echo $ECHO_N "checking for docdir... $ECHO_C" >&6; } -# Check whether --with-doc or --without-doc was given. +# Check whether --with-doc was given. if test "${with_doc+set}" = set; then - withval="$with_doc" - DOCDIR="$withval" + withval=$with_doc; DOCDIR="$withval" else DOCDIR="../babelweb/" -fi; +fi + # Checks for header files. @@ -3365,9 +4500,9 @@ fi; for ac_func in nanosleep sleep do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -3393,68 +4528,60 @@ cat >>conftest.$ac_ext <<_ACEOF #undef $ac_func -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" -{ #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#if defined __stub_$ac_func || defined __stub___$ac_func choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} #endif int main () { -return f != $ac_func; +return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" + eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 @@ -3464,7 +4591,7 @@ fi done - ac_config_files="$ac_config_files Makefile gbversion.h xmldoc/makedoc tools/mkcapabilities win32/gpsbabel.rc coldsync/Makefile jeeps/Makefile shapelib/Makefile zlib/empty" +ac_config_files="$ac_config_files Makefile gbversion.h xmldoc/makedoc tools/mkcapabilities win32/gpsbabel.rc coldsync/Makefile jeeps/Makefile shapelib/Makefile zlib/empty" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -3484,39 +4611,58 @@ _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. +# So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -{ +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; + ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} | + esac | + sort +) | sed ' + /^ac_cv_env_/b end t clear - : clear + :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else - echo "not updating unwritable cache $cache_file" + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -3525,32 +4671,18 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -3581,17 +4713,45 @@ cat >>$CONFIG_STATUS <<\_ACEOF ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh fi -DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then @@ -3601,8 +4761,43 @@ else fi +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + # Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done PS1='$ ' PS2='> ' PS4='+ ' @@ -3616,178 +4811,140 @@ do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else - $as_unset $as_var + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false fi - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop - s,-$,, - s,^['$as_cr_digits']*\n,, + s/-\n.*// ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" # Exit status is that of the last command. exit } -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi -rm -f conf$$ conf$$.exe conf$$.file +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: @@ -3796,7 +4953,28 @@ else as_mkdir_p=false fi -as_executable_p="test -f" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -3805,31 +4983,14 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - exec 6>&1 -# Open the log real soon, to keep \$[0] and so on meaningful, and to +# Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - +# values after options handling. +ac_log=" This file was extended by GPSBabel $as_me 1.3.4, which was -generated by GNU Autoconf 2.59. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -3837,30 +4998,19 @@ generated by GNU Autoconf 2.59. Invocation command line was CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + _ACEOF +cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi +config_files="$ac_config_files" +config_headers="$ac_config_headers" -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi +_ACEOF cat >>$CONFIG_STATUS <<\_ACEOF - ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. @@ -3868,7 +5018,7 @@ current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit - -V, --version print version number, then exit + -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions @@ -3884,19 +5034,21 @@ Configuration headers: $config_headers Report bugs to ." -_ACEOF +_ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ GPSBabel config.status 1.3.4 -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF @@ -3907,39 +5059,24 @@ while test $# != 0 do case $1 in --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; - -*) + *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; esac case $ac_option in # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift @@ -3949,18 +5086,24 @@ Try \`$0 --help' for more information." >&2;} $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; - *) ac_config_targets="$ac_config_targets $1" ;; + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; esac shift @@ -3976,37 +5119,51 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 - - - +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. for ac_config_target in $ac_config_targets do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "gbversion.h" ) CONFIG_FILES="$CONFIG_FILES gbversion.h" ;; - "xmldoc/makedoc" ) CONFIG_FILES="$CONFIG_FILES xmldoc/makedoc" ;; - "tools/mkcapabilities" ) CONFIG_FILES="$CONFIG_FILES tools/mkcapabilities" ;; - "win32/gpsbabel.rc" ) CONFIG_FILES="$CONFIG_FILES win32/gpsbabel.rc" ;; - "coldsync/Makefile" ) CONFIG_FILES="$CONFIG_FILES coldsync/Makefile" ;; - "jeeps/Makefile" ) CONFIG_FILES="$CONFIG_FILES jeeps/Makefile" ;; - "shapelib/Makefile" ) CONFIG_FILES="$CONFIG_FILES shapelib/Makefile" ;; - "zlib/empty" ) CONFIG_FILES="$CONFIG_FILES zlib/empty" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "gbversion.h") CONFIG_FILES="$CONFIG_FILES gbversion.h" ;; + "xmldoc/makedoc") CONFIG_FILES="$CONFIG_FILES xmldoc/makedoc" ;; + "tools/mkcapabilities") CONFIG_FILES="$CONFIG_FILES tools/mkcapabilities" ;; + "win32/gpsbabel.rc") CONFIG_FILES="$CONFIG_FILES win32/gpsbabel.rc" ;; + "coldsync/Makefile") CONFIG_FILES="$CONFIG_FILES coldsync/Makefile" ;; + "jeeps/Makefile") CONFIG_FILES="$CONFIG_FILES jeeps/Makefile" ;; + "shapelib/Makefile") CONFIG_FILES="$CONFIG_FILES shapelib/Makefile" ;; + "zlib/empty") CONFIG_FILES="$CONFIG_FILES zlib/empty" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done + # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely @@ -4017,326 +5174,397 @@ if $ac_need_defaults; then fi # Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, +# simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. $debug || { - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } - # Create a (secure) tmp directory for tmp files. { - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - # -# CONFIG_FILES section. +# Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@PACKAGE_RELEASE@,$PACKAGE_RELEASE,;t t -s,@GBMAJOR@,$GBMAJOR,;t t -s,@GBMINOR@,$GBMINOR,;t t -s,@GBMICRO@,$GBMICRO,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t -s,@target@,$target,;t t -s,@target_cpu@,$target_cpu,;t t -s,@target_vendor@,$target_vendor,;t t -s,@target_os@,$target_os,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@FILEINFO@,$FILEINFO,;t t -s,@RC@,$RC,;t t -s,@LIBUSBCONFIG@,$LIBUSBCONFIG,;t t -s,@USB_LIBS@,$USB_LIBS,;t t -s,@USB_CFLAGS@,$USB_CFLAGS,;t t -s,@OSJEEPS@,$OSJEEPS,;t t -s,@GBSER@,$GBSER,;t t -s,@ZLIB@,$ZLIB,;t t -s,@EXPAT_LIB@,$EXPAT_LIB,;t t -s,@EFENCE_LIB@,$EFENCE_LIB,;t t -s,@GPSBABEL_DEBUG@,$GPSBABEL_DEBUG,;t t -s,@INSTALL_DEBUG@,$INSTALL_DEBUG,;t t -s,@DOCDIR@,$DOCDIR,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF +if test -n "$CONFIG_FILES"; then _ACEOF - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +PACKAGE_RELEASE!$PACKAGE_RELEASE$ac_delim +GBMAJOR!$GBMAJOR$ac_delim +GBMINOR!$GBMINOR$ac_delim +GBMICRO!$GBMICRO$ac_delim +build!$build$ac_delim +build_cpu!$build_cpu$ac_delim +build_vendor!$build_vendor$ac_delim +build_os!$build_os$ac_delim +host!$host$ac_delim +host_cpu!$host_cpu$ac_delim +host_vendor!$host_vendor$ac_delim +host_os!$host_os$ac_delim +target!$target$ac_delim +target_cpu!$target_cpu$ac_delim +target_vendor!$target_vendor$ac_delim +target_os!$target_os$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +SET_MAKE!$SET_MAKE$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +PALM_DB_CMT!$PALM_DB_CMT$ac_delim +FILEINFO!$FILEINFO$ac_delim +RC!$RC$ac_delim +LIBUSBCONFIG!$LIBUSBCONFIG$ac_delim +USB_LIBS!$USB_LIBS$ac_delim +USB_CFLAGS!$USB_CFLAGS$ac_delim +OSJEEPS!$OSJEEPS$ac_delim +GBSER!$GBSER$ac_delim +ZLIB!$ZLIB$ac_delim +EXPAT_LIB!$EXPAT_LIB$ac_delim +EFENCE_LIB!$EFENCE_LIB$ac_delim +GPSBABEL_DEBUG!$GPSBABEL_DEBUG$ac_delim +INSTALL_DEBUG!$INSTALL_DEBUG$ac_delim +DOCDIR!$DOCDIR$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 83; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi -fi # test -n "$CONFIG_FILES" +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; esac - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || + ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } - ac_builddir=. -if test "$ac_dir" != .; then +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # We are building in place. ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac + case $ac_mode in + :F) + # + # CONFIG_FILE + # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac +_ACEOF - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac _ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub @@ -4344,252 +5572,137 @@ _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - + ;; + :H) + # + # CONFIG_HEADER + # _ACEOF -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for +# Transform confdefs.h into a sed script `conftest.defines', that +# substitutes the proper values into config.h.in to produce config.h. +rm -f conftest.defines conftest.tail +# First, append a space to every undef/define line, to ease matching. +echo 's/$/ /' >conftest.defines +# Then, protect against being on the right side of a sed subst, or in +# an unquoted here document, in config.status. If some macros were +# called several times there might be several #defines for the same +# symbol, which is useless. But do not sort them, since the last +# AC_DEFINE must be honored. +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where +# NAME is the cpp macro being defined, VALUE is the value it is being given. +# PARAMS is the parameter list in the macro definition--in most cases, it's +# just an empty string. +ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' +ac_dB='\\)[ (].*,\\1define\\2' +ac_dC=' ' +ac_dD=' ,' + +uniq confdefs.h | + sed -n ' + t rset + :rset + s/^[ ]*#[ ]*define[ ][ ]*// + t ok + d + :ok + s/[\\&,]/\\&/g + s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p + s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p + ' >>conftest.defines + +# Remove the space that was appended to ease matching. +# Then replace #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null +# (The regexp can be short, since the line contains either #define or #undef.) +echo 's/ $// +s,^[ #]*u.*,/* & */,' >>conftest.defines + +# Break up conftest.defines: +ac_max_sed_lines=50 + +# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" +# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" +# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" +# et cetera. +ac_in='$ac_file_inputs' +ac_out='"$tmp/out1"' +ac_nxt='"$tmp/out2"' + +while : do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + # Write a here document: + cat >>$CONFIG_STATUS <<_ACEOF + # First, check the format of the line: + cat >"\$tmp/defines.sed" <<\\CEOF +/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def +/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def +b +:def +_ACEOF + sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS + ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in + sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail + grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs +rm -f conftest.defines conftest.tail +echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - rm -f $ac_file - mv $tmp/config.h $ac_file + mv "$tmp/config.h" $ac_file fi else - cat $tmp/config.h - rm -f $tmp/config.h + echo "/* $configure_input */" + cat "$ac_result" fi -done -_ACEOF + rm -f "$tmp/out12" + ;; + + + esac + +done # for ac_tag -cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF diff --git a/configure.in b/configure.in index 7b424e585..5c20f75d9 100644 --- a/configure.in +++ b/configure.in @@ -68,8 +68,10 @@ AC_ARG_ENABLE(pdb, AC_DEFINE(PDBFMTS_ENABLED, 1, [1 to enable Palm PDB support]) AC_MSG_RESULT(yes) else + PALM_DB_CMT=# AC_MSG_RESULT(no) fi +AC_SUBST(PALM_DB_CMT) AC_MSG_CHECKING(whether to support csv formats) AC_ARG_ENABLE(csv, diff --git a/pilot-link/README.gpsbabel b/pilot-link/README.gpsbabel new file mode 100644 index 000000000..0e1fc23a9 --- /dev/null +++ b/pilot-link/README.gpsbabel @@ -0,0 +1,6 @@ +This directory is a tiny subset of the pilot-link 0.12.2 code from +http://www.pilot-link.org. It is licensed under the GPL. + +We considered conditionalizing away some of the code we didn't use, but +once we realized the compiled object size was already smaller than the +coldsync code it replaces, that didn't make sense. diff --git a/pilot-link/pi-args.h b/pilot-link/pi-args.h new file mode 100644 index 000000000..1ce3d67bc --- /dev/null +++ b/pilot-link/pi-args.h @@ -0,0 +1,36 @@ +/* + * $Id: pi-args.h,v 1.1 2007/07/21 03:54:52 robertl Exp $ + * + * pi-args.h: Macros for prototype definitions + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library + * General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __PILOT_ARGS_H__ +#define __PILOT_ARGS_H__ + +/** @file pi-args.h + * @brief Macros for prototype definitions + * + */ +#if ((defined(__STDC__) || defined(SABER)) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) || defined(USE_PROTOTYPE) || defined(CAN_PROTOTYPE) +# define PI_ARGS(x) x +# define PI_CONST const +#else +# define PI_ARGS(x) () +# define PI_CONST +#endif + +#endif diff --git a/pilot-link/pi-buffer.c b/pilot-link/pi-buffer.c new file mode 100644 index 000000000..cb90369cc --- /dev/null +++ b/pilot-link/pi-buffer.c @@ -0,0 +1,118 @@ +/* + * $Id: pi-buffer.c,v 1.1 2007/07/21 03:54:52 robertl Exp $ + * + * pi-buffer.c: simple data block management for variable data storage + * + * Copyright (c) 2004-2005, Florent Pillet. + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library + * General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + */ +#include +#include +#include + +#include "defs.h" +#include "pi-buffer.h" + +pi_buffer_t* +pi_buffer_new (size_t capacity) +{ + pi_buffer_t* buf; + buf = (struct pi_buffer_t *) xmalloc (sizeof (struct pi_buffer_t)); + if (buf == NULL) + return NULL; + + if (capacity <= 0) + capacity = 16; /* allocating 0 byte is illegal - use a small value instead */ + + buf->data = (unsigned char *) xmalloc (capacity); + if (buf->data == NULL) { + free (buf); + return NULL; + } + + buf->allocated = capacity; + buf->used = 0; + return buf; +} + +pi_buffer_t* +pi_buffer_expect (pi_buffer_t *buf, size_t expect) +{ + if ((buf->allocated - buf->used) >= expect) + return buf; + + if (buf->data) + buf->data = (unsigned char *) realloc (buf->data, buf->used + expect); + else + buf->data = (unsigned char *) xmalloc (expect); + + if (buf->data == NULL) { + buf->allocated = 0; + buf->used = 0; + return NULL; + } + + buf->allocated = buf->used + expect; + return buf; +} + +pi_buffer_t* +pi_buffer_append (pi_buffer_t *buf, const void *data, size_t len) +{ + if (pi_buffer_expect (buf, len) == NULL) + return NULL; + + memcpy (buf->data + buf->used, data, len); + buf->used += len; + + return buf; +} + +pi_buffer_t * +pi_buffer_append_buffer (pi_buffer_t *dest, const pi_buffer_t *src) +{ + return pi_buffer_append (dest, src->data, src->used); +} + +void +pi_buffer_clear (pi_buffer_t *buf) +{ + buf->used = 0; + if (buf->allocated > (size_t)65535) + { + buf->data = (unsigned char *) realloc (buf->data, 65535); + buf->allocated = (buf->data == NULL) ? 0 : 65535; + } +} + +void +pi_buffer_free (pi_buffer_t* buf) +{ + if (buf) { + if (buf->data) + xfree (buf->data); + xfree (buf); + } +} + +/* vi: set ts=8 sw=4 sts=4 noexpandtab: cin */ +/* ex: set tabstop=4 expandtab: */ +/* Local Variables: */ +/* indent-tabs-mode: t */ +/* c-basic-offset: 8 */ +/* End: */ diff --git a/pilot-link/pi-buffer.h b/pilot-link/pi-buffer.h new file mode 100644 index 000000000..4b6af9716 --- /dev/null +++ b/pilot-link/pi-buffer.h @@ -0,0 +1,143 @@ +/* + * $Id: pi-buffer.h,v 1.1 2007/07/21 03:54:52 robertl Exp $ + * + * pi-buffer.h: simple data block management for variable data storage + * + * Copyright (c) 2004-2005, Florent Pillet. + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library + * General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; if not, write to the Free Software Foundation, + * * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** @file pi-buffer.h + * @brief Variable size buffer management interface + * @author Florent Pillet + * + * pi-buffer provides for a reliable and easy to use variable size buffer + * management, allowing for buffers that grow as needed to store + * variable-length data. + * + * When you create a buffer with pi_buffer_new(), you indicate an initial + * capacity that is allocated. The number of used bytes is set to 0. To + * append data to the buffer, use pi_buffer_append(). This ensures that the + * buffer grows as needed. + * + * You can access data in the buffer using the @a buffer->data member. The + * number of bytes used is always accessible using @a buffer->used. + * + * It is possible to use the pi-buffer functions on static buffers. In this + * case, you won't call pi_buffer_free() on the structure. You'll dispose of + * the memory yourself instead. Here is an example: + * + * @code + * pi_buffer_t mybuf; + * mybuf.data = (unsigned char *) malloc(256); + * mybuf.allocated = 256; + * mybuf.used = 0; + * + * // ... perform your tasks here .... + * pi_buffer_append(&mybuf, somedata, somedatasize); + * // ... + * + * free(mybuf.data); + * @endcode + */ + +#ifndef _PILOT_BUFFER_H_ +#define _PILOT_BUFFER_H_ + +#include "pi-args.h" + +#ifdef __cplusplus +extern "C" { +#endif + /** @brief Variable buffer structure */ + typedef struct pi_buffer_t { + unsigned char *data; /**< Pointer to the data */ + size_t allocated; /**< Number of bytes allocated */ + size_t used; /**< Number of allocated bytes actually used */ + } pi_buffer_t; + + /** @brief Create a new variable size buffer + * + * Dispose of this buffer with pi_buffer_free() + * + * @param capacity Initial size to allocate + * @return A newly allocated pi_buffer_t structure + */ + extern pi_buffer_t* pi_buffer_new + PI_ARGS((size_t capacity)); + + /** @brief Ensure the buffer is large enough to store @p capacity bytes of data + * + * This grows the allocated buffer as needed and updates the @a allocated + * member. Doesn't touch the @a used member. After this call succeeds, you + * can directly use the @a buffer->data pointer to store up to + * @a buffer->allocated bytes using direct memory access. + * + * @param buf The buffer to grow + * @param new_capacity The total number of bytes the buffer is expected to contain + * @return The @p buf buffer on success, NULL if a memory error happened + */ + extern pi_buffer_t* pi_buffer_expect + PI_ARGS((pi_buffer_t *buf, size_t new_capacity)); + + /** @brief Append data to the buffer + * + * Grow the buffer if needed. + * + * @param buf The buffer to grow + * @param data Pointer to the data to append + * @param len Length of the data to append + * @return The @p buf buffer on success, NULL if a memory error happened + */ + extern pi_buffer_t* pi_buffer_append + PI_ARGS((pi_buffer_t *buf, PI_CONST void *data, size_t len)); + + /** @brief Append a buffer to another buffer + * + * @param dest The buffer to append to + * @param src Buffer whose data will be appended to @p dest + * @return The @p dest buffer on success, NULL if a memory error happened + */ + extern pi_buffer_t* pi_buffer_append_buffer + PI_ARGS((pi_buffer_t *dest, PI_CONST pi_buffer_t *src)); + + /** @brief Reset the @a used member of a buffer + * + * The @p used member is set to 0. If the actual allocated bytes is large, + * the allocation may shrink to a reasonable value to prevent unneeded + * memory use. + * + * @param buf The buffer to clear + * @return The @p buf parameter + */ + extern void pi_buffer_clear + PI_ARGS((pi_buffer_t *buf)); + + /** @brief Dispose of all memory used by a buffer allocated with pi_buffer_new() + * + * After this call, the @p buf structure itself will have been freed as well. + * Do not reuse the pointer. + * + * @param buf The buffer to dispose of + */ + extern void pi_buffer_free + PI_ARGS((pi_buffer_t *buf)); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/pilot-link/pi-debug.h b/pilot-link/pi-debug.h new file mode 100644 index 000000000..c1caf68ae --- /dev/null +++ b/pilot-link/pi-debug.h @@ -0,0 +1,101 @@ +/* + * $Id: pi-debug.h,v 1.1 2007/07/21 03:54:52 robertl Exp $ + * + * pi-debug.h: Debugging utilities + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library + * General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _PILOT_DEBUG_H_ +#define _PILOT_DEBUG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "pi-args.h" + +#define PI_DBG_NONE 0x000 +#define PI_DBG_SYS 0x001 +#define PI_DBG_DEV 0x002 +#define PI_DBG_SLP 0x004 +#define PI_DBG_PADP 0x008 +#define PI_DBG_DLP 0x010 +#define PI_DBG_NET 0x020 +#define PI_DBG_CMP 0x040 +#define PI_DBG_SOCK 0x080 +#define PI_DBG_API 0x100 +#define PI_DBG_USER 0x200 +#define PI_DBG_ALL 0x400 + +#define PI_DBG_LVL_NONE 0x00 +#define PI_DBG_LVL_ERR 0x01 +#define PI_DBG_LVL_WARN 0x02 +#define PI_DBG_LVL_INFO 0x04 +#define PI_DBG_LVL_DEBUG 0x08 + +extern int pi_debug_get_types PI_ARGS((void)); +extern void pi_debug_set_types PI_ARGS((int types)); + +extern int pi_debug_get_level PI_ARGS((void)); +extern void pi_debug_set_level PI_ARGS((int level)); + +extern void pi_debug_set_file PI_ARGS((const char *path)); + +extern void pi_log PI_ARGS((int type, int level, PI_CONST char *format, ...)); + +extern void pi_dumpline + PI_ARGS((PI_CONST char *buf, size_t len, unsigned int addr)); + +extern void pi_dumpdata + PI_ARGS((PI_CONST char *buf, size_t len)); + +#ifdef PI_DEBUG +#define ASSERT(expr) \ + do { \ + if (!(expr)) { \ + pi_log (PI_DBG_ALL, PI_DBG_LVL_NONE, \ + "file %s: line %d: assertion failed: (%s)", \ + __FILE__, \ + __LINE__, \ + #expr); \ + } \ + } while (0); + +#define CHECK(type, level, expr) \ + do { \ + if ((pi_debug_get_types () & type) \ + && pi_debug_get_level () >= level) \ + expr; \ + } while (0); + +#define LOG(x) pi_log x + +#else +#define ASSERT(expr) +#define CHECK(type, level, expr) + +#define LOG(x) + +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/pilot-link/pi-dlp.h b/pilot-link/pi-dlp.h new file mode 100644 index 000000000..1dde10264 --- /dev/null +++ b/pilot-link/pi-dlp.h @@ -0,0 +1,1856 @@ +/* + * $Id: pi-dlp.h,v 1.1 2007/07/21 03:54:52 robertl Exp $ + * + * pi-dlp.h: Desktop Link Protocol implementation (ala SLP) + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library + * General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** @file pi-dlp.h + * @brief Direct protocol interface to the device using the HotSync protocol. + * + * The DLP layer is the lowest interface layer applications can use to + * access a handheld. It provides equivalents to Palm Conduit Development + * Kit (CDK)'s SyncXXX functions, as well as a number of convenience + * functions that are not found in the CDK. + * + * Once you have a socket number and a device is connected, you can start + * using DLP calls to talk with the device. All DLP calls are @b + * synchronous: they are immediately sent to the device and the current + * thread is blocked until either a response is received, or an error + * occurs. + * + * It is a good pratice to always check errors returned by DLP calls. + * Usually, if the value is nagative, it is an error code. If the error is + * #PI_ERR_DLP_PALMOS, an error code was returned by the device itself: you + * can get this error code by calling pi_palmos_error() on the current + * socket. Besides all the Palm OS error code defined in Palm's + * documentation, there are a few values between #dlpErrNoError and + * #dlpErrUnknown which are error returned by the DLP layer itself on the + * device. + * + * The DLP protocol is the low level protocol that HotSync uses. Over the + * years, there have been several iterations of DLP. Pre-Palm OS 5 devices + * have DLP 1.2 or lower. Palm OS 5 devices have DLP 1.3 or 1.4 (Palm OS 5.2 + * and up). Cobalt (Palm OS 6) uses DLP 2.1. + * + * Devices with DLP 1.4 and later are known to support transfers of large + * records and resources (of size bigger than 64k). This is the case of the + * Tapwave Zodiac, for example. + * + * Note that some devices report an incorrect version of DLP. Some Palm OS 5 + * devices report using DLP 1.2 whereas they really support DLP 1.3. + * + * Depending on which devices you plan on being compatible with, you should adjust + * #PI_DLP_VERSION_MAJOR and #PI_DLP_VERSION_MINOR. If you want to support + * devices up to and including Palm OS 5, setting your DLP version to 1.4 is + * a good idea. If you want to be able to connect to Palm OS 6, you need to + * set your DLP version to 2.1. + */ + +#ifndef _PILOT_DLP_H_ +#define _PILOT_DLP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "pi-macros.h" /* For recordid_t */ +#include "pi-buffer.h" /* For pi_buffer_t */ +#include "pi-error.h" /* For PI_ERR */ + +/* version of the DLP protocol supported in this version */ +/* Hint for existing versions: + * 1.2: Palm OS 4 / Palm OS 5 (OS 5 should be 1.3 but incorrectly reports 1.2) + * 1.4: TapWave Palm OS 5 + * 2.1: Palm OS 6 + */ +#define PI_DLP_VERSION_MAJOR 1 /**< Major DLP protocol version we report to the device. */ +#define PI_DLP_VERSION_MINOR 4 /**< Minor DLP protocol version we report to the device. */ + +#ifndef SWIG + #define DLP_BUF_SIZE 0xffff /**< Kept for compatibility, applications should avoid using this value. */ +#endif /* !SWIG */ + +/** @name Internal definitions used to assemble DLP calls */ +/*@{*/ +#ifndef SWIG + #define PI_DLP_OFFSET_CMD 0 + #define PI_DLP_OFFSET_ARGC 1 + #define PI_DLP_OFFSET_ARGV 2 + + #define PI_DLP_ARG_TINY_LEN 0x000000FFL + #define PI_DLP_ARG_SHORT_LEN 0x0000FFFFL + #define PI_DLP_ARG_LONG_LEN 0xFFFFFFFFL + + #define PI_DLP_ARG_FLAG_TINY 0x00 + #define PI_DLP_ARG_FLAG_SHORT 0x80 + #define PI_DLP_ARG_FLAG_LONG 0x40 + #define PI_DLP_ARG_FLAG_MASK 0xC0 + + #define PI_DLP_ARG_FIRST_ID 0x20 +#endif /* !SWIG */ +/*@}*/ + +/** @name VFS definitions */ +/*@{*/ +#define vfsMountFlagsUseThisFileSystem 0x01 /**< Mount/Format the volume with the filesystem specified */ +#define vfsMAXFILENAME 256 /**< The maximum size of a filename in a VFS volume */ +#define vfsInvalidVolRef 0 /**< constant for an invalid volume reference, guaranteed not to represent a valid one. Use it like you would use NULL for a FILE*. */ +#define vfsInvalidFileRef 0L /**< constant for an invalid file reference, guaranteed not to represent a valid one. Use it like you would use NULL for a FILE*. */ +/*@}*/ + +typedef unsigned long FileRef; /**< Type for file references when working with VFS files and directories. */ + +/** @brief Information retrieved by dlp_VFSDirEntryEnumerate() */ +struct VFSDirInfo { + unsigned long attr; /**< File or directory attributes (see VSF File attribute definitions) */ + char name[vfsMAXFILENAME]; /**< File or directory name */ +}; + +/** @brief Information used to format a volume with dlp_VFSVolumeFormat() */ +struct VFSAnyMountParam { + unsigned short volRefNum; + unsigned short reserved; + unsigned long mountClass; +}; + +/** @brief Information used to format a volume with dlp_VFSVolumeFormat() */ +struct VFSSlotMountParam { + struct VFSAnyMountParam vfsMountParam; + unsigned short slotLibRefNum; + unsigned short slotRefNum; +}; + +/** @brief Information about a VFS volume, returned by dlp_VFSVolumeInfo() */ +struct VFSInfo { + /* 0: read-only etc. */ + unsigned long attributes; /**< Volume attributes (see #dlpVFSVolumeAttributes enum) */ + + /* 4: Filesystem type for this volume (defined below). + These you can expect to see in devices: + 'vfat' (FAT12/FAT16 with long name support) + + Other values observed: + 'twmf' (Tapwave Zodiac internal VFS) + + PalmSource defines these, but don't bet on device support: + 'afsu' (Andrew network filesystem) + 'ext2' (Linux ext2 filesystem) + 'fats' (FAT12/FAT16 with 8.3 names) + 'ffsb' (BSD block-based filesystem) + 'hfse' (Macintosh HFS+) + 'hfss' (Macintosh HFS, pre-8.x) + 'hpfs' (OS/2 High Performance Filesystem) + 'mfso' (Original Macintosh filesystem) + 'nfsu' (NFS mount) + 'novl' (Novell filesystem) + 'ntfs' (Windows NT filesystem) + */ + unsigned long fsType; /**< File system time (four-char code, see above) */ + + /* 8: Creator code of filesystem driver for this volume. */ + unsigned long fsCreator; /**< File system creator (four-char code) */ + + /* For slot based filesystems: (mountClass = VFSMountClass_SlotDriver) + 12: mount class that mounted this volume */ + unsigned long mountClass; /**< Mount class */ + + /* 16: Library on which the volume is mounted */ + int slotLibRefNum; /**< Slot library reference number */ + + /* 18: ExpMgr slot number of card containing volume */ + int slotRefNum; /**< Expansion manager slot number */ + + /* 20: Type of card media (mediaMemoryStick, mediaCompactFlash, etc.) + These you can expect to see in devices: + 'cfsh' (CompactFlash) + 'mmcd' (MultiMedia Card) + 'mstk' (Memory Stick) + 'sdig' (SD card) + + Other values observed: + 'TFFS' (palmOne Tungsten T5 internal VFS) + 'twMF' (Tapwave Zodiac internal VFS) + + PalmSource also defines these: + 'pose' (Host filesystem emulated by POSE) + 'PSim' (Host filesystem emulated by Mac Simulator) + 'ramd' (RAM disk) + 'smed' (SmartMedia) + */ + unsigned long mediaType; /**< Media type (see above) */ + + /* 24: reserved for future use (other mountclasses may need more space) */ + unsigned long reserved; /**< Reserved, set to 0 */ +}; + +/** @brief Information about the handheld user + * + * This structure is used in dlp_ReadUserInfo() and dlp_WriteUserInfo() + */ +struct PilotUser { + size_t passwordLength; + char username[128]; + char password[128]; + unsigned long userID; + unsigned long viewerID; + unsigned long lastSyncPC; + time_t successfulSyncDate; + time_t lastSyncDate; +}; + +/** @brief Device information. + * + * This structure is filled by dlp_ReadSysInfo() + */ +struct SysInfo { + unsigned long romVersion; /**< Version of the device ROM, of the form 0xMMmmffssbb where MM=Major, mm=minor, ff=fix, ss=stage, bb=build */ + unsigned long locale; /**< Locale for this device */ + unsigned char prodIDLength; /**< Length of the prodID string */ + char prodID[128]; /**< Product ID */ + unsigned short dlpMajorVersion; /**< Major version of the DLP protocol on this device */ + unsigned short dlpMinorVersion; /**< Minor version of the DLP protocol on this device */ + unsigned short compatMajorVersion; /**< Minimum major version of DLP this device is compatible with */ + unsigned short compatMinorVersion; /**< Minimum minor version of DLP this device is compatible with */ + unsigned long maxRecSize; /**< Maximum record size. Usually <=0xFFFF or ==0 for older devices (means records are limited to 64k), can be much larger for devices with DLP >= 1.4 (i.e. 0x00FFFFFE) */ +}; + +/** @brief Database information. + * + * A database information block is returned by dlp_ReadDBList(), dlp_FindDBInfo(), dlp_FindDBByName(), dlp_FindDBByOpenHandle() + * and dlp_FindDBByTypeCreator(). + */ +struct DBInfo { + int more; /**< When reading database list using dlp_ReadDBList(), this flag is set if there are more databases to come */ + char name[34]; /**< Database name, 32 characters max. */ + unsigned int flags; /**< Database flags (@see dlpDBFlags enum) */ + unsigned int miscFlags; /**< Additional database flags filled by pilot-link (@see dlpDBMiscFlags enum) */ + unsigned int version; /**< Database version number */ + unsigned long type; /**< Database type (four-char code, i.e. 'appl') */ + unsigned long creator; /**< Database creator (four-char code, i.e. 'DATA') */ + unsigned long modnum; /**< Modification count */ + unsigned int index; /**< Database index in database list */ + time_t createDate; /**< Database creation date (using the machine's local time zone) */ + time_t modifyDate; /**< Last time this database was modified (using the machine's local time zone). If the database was never modified, this field is set to 0x83DAC000 (Fri Jan 1 00:00:00 1904 GMT) */ + time_t backupDate; /**< Last time this database was backed up using HotSync. If the database was never backed up, this field is set to 0x83DAC000 (Fri Jan 1 00:00:00 1904 GMT) */ +}; + +/** @brief Size information for a database. + * + * Returned by dlp_FindDBByName(), dlp_FindDBByOpenHandle() and dlp_FindDBByTypeCreator(). + */ +struct DBSizeInfo { + unsigned long numRecords; /**< Number of records or resources */ + unsigned long totalBytes; /**< Total number of bytes occupied by the database, including header and records list */ + unsigned long dataBytes; /**< Total number of data bytes contained in the database's records or resources */ + unsigned long appBlockSize; /**< Size of the appInfo block */ + unsigned long sortBlockSize; /**< Size of the sortInfo block */ + unsigned long maxRecSize; /**< note: this field is always set to 0 on return from dlp_FindDBxxx */ +}; + +/** @brief Information about a memory card. + * + * This structure describes a device's internal storage only, not removable media. + * It is returned by dlp_ReadStorageInfo(). + */ +struct CardInfo { + int card; /**< Memory card index (most devices only have one). */ + int version; /**< Version of the card */ + int more; /**< Set if there is another card after this one */ + time_t creation; /**< Creation date (using the computer's local time zone) */ + unsigned long romSize; /**< Size of the ROM block on this card (in bytes) */ + unsigned long ramSize; /**< Size of the RAM block on this card (in bytes) */ + unsigned long ramFree; /**< Total free RAM bytes */ + char name[128]; /**< Card name */ + char manufacturer[128]; /**< Card manufacturer name */ +}; + +/** @brief Network HotSync information. + * + * Returned by dlp_ReadNetSyncInfo(). Gives the network location of a remote handheld. + */ +struct NetSyncInfo { + int lanSync; /**< Non-zero if LanSync is turned on on the device */ + char hostName[256]; /**< Device hostname if any. Null terminated string. */ + char hostAddress[40]; /**< Device host address. Null terminated string. */ + char hostSubnetMask[40]; /**< Device subnet mask. Null terminated string */ +}; + +#ifndef SWIG /* no need to clutter the bindings with this */ +enum dlpFunctions { + /* range reserved for internal use */ + dlpReservedFunc = 0x0F, + + /* DLP 1.0 FUNCTIONS START HERE (PalmOS v1.0) */ + dlpFuncReadUserInfo, /* 0x10 */ + dlpFuncWriteUserInfo, /* 0x11 */ + dlpFuncReadSysInfo, /* 0x12 */ + dlpFuncGetSysDateTime, /* 0x13 */ + dlpFuncSetSysDateTime, /* 0x14 */ + dlpFuncReadStorageInfo, /* 0x15 */ + dlpFuncReadDBList, /* 0x16 */ + dlpFuncOpenDB, /* 0x17 */ + dlpFuncCreateDB, /* 0x18 */ + dlpFuncCloseDB, /* 0x19 */ + dlpFuncDeleteDB, /* 0x1a */ + dlpFuncReadAppBlock, /* 0x1b */ + dlpFuncWriteAppBlock, /* 0x1c */ + dlpFuncReadSortBlock, /* 0x1d */ + dlpFuncWriteSortBlock, /* 0x1e */ + dlpFuncReadNextModifiedRec, /* 0x1f */ + dlpFuncReadRecord, /* 0x20 */ + dlpFuncWriteRecord, /* 0x21 */ + dlpFuncDeleteRecord, /* 0x22 */ + dlpFuncReadResource, /* 0x23 */ + dlpFuncWriteResource, /* 0x24 */ + dlpFuncDeleteResource, /* 0x25 */ + dlpFuncCleanUpDatabase, /* 0x26 */ + dlpFuncResetSyncFlags, /* 0x27 */ + dlpFuncCallApplication, /* 0x28 */ + dlpFuncResetSystem, /* 0x29 */ + dlpFuncAddSyncLogEntry, /* 0x2a */ + dlpFuncReadOpenDBInfo, /* 0x2b */ + dlpFuncMoveCategory, /* 0x2c */ + dlpProcessRPC, /* 0x2d */ + dlpFuncOpenConduit, /* 0x2e */ + dlpFuncEndOfSync, /* 0x2f */ + dlpFuncResetRecordIndex, /* 0x30 */ + dlpFuncReadRecordIDList, /* 0x31 */ + + /* DLP 1.1 FUNCTIONS ADDED HERE (PalmOS v2.0 Personal, and Professional) */ + dlpFuncReadNextRecInCategory, /* 0x32 */ + dlpFuncReadNextModifiedRecInCategory, /* 0x33 */ + dlpFuncReadAppPreference, /* 0x34 */ + dlpFuncWriteAppPreference, /* 0x35 */ + dlpFuncReadNetSyncInfo, /* 0x36 */ + dlpFuncWriteNetSyncInfo, /* 0x37 */ + dlpFuncReadFeature, /* 0x38 */ + + /* DLP 1.2 FUNCTIONS ADDED HERE (PalmOS v3.0) */ + dlpFuncFindDB, /* 0x39 */ + dlpFuncSetDBInfo, /* 0x3a */ + + /* DLP 1.3 FUNCTIONS ADDED HERE (PalmOS v4.0) */ + dlpLoopBackTest, /* 0x3b */ + dlpFuncExpSlotEnumerate, /* 0x3c */ + dlpFuncExpCardPresent, /* 0x3d */ + dlpFuncExpCardInfo, /* 0x3e */ + dlpFuncVFSCustomControl, /* 0x3f */ + dlpFuncVFSGetDefaultDir, /* 0x40 */ + dlpFuncVFSImportDatabaseFromFile, /* 0x41 */ + dlpFuncVFSExportDatabaseToFile, /* 0x42 */ + dlpFuncVFSFileCreate, /* 0x43 */ + dlpFuncVFSFileOpen, /* 0x44 */ + dlpFuncVFSFileClose, /* 0x45 */ + dlpFuncVFSFileWrite, /* 0x46 */ + dlpFuncVFSFileRead, /* 0x47 */ + dlpFuncVFSFileDelete, /* 0x48 */ + dlpFuncVFSFileRename, /* 0x49 */ + dlpFuncVFSFileEOF, /* 0x4a */ + dlpFuncVFSFileTell, /* 0x4b */ + dlpFuncVFSFileGetAttributes, /* 0x4c */ + dlpFuncVFSFileSetAttributes, /* 0x4d */ + dlpFuncVFSFileGetDate, /* 0x4e */ + dlpFuncVFSFileSetDate, /* 0x4f */ + dlpFuncVFSDirCreate, /* 0x50 */ + dlpFuncVFSDirEntryEnumerate, /* 0x51 */ + dlpFuncVFSGetFile, /* 0x52 */ + dlpFuncVFSPutFile, /* 0x53 */ + dlpFuncVFSVolumeFormat, /* 0x54 */ + dlpFuncVFSVolumeEnumerate, /* 0x55 */ + dlpFuncVFSVolumeInfo, /* 0x56 */ + dlpFuncVFSVolumeGetLabel, /* 0x57 */ + dlpFuncVFSVolumeSetLabel, /* 0x58 */ + dlpFuncVFSVolumeSize, /* 0x59 */ + dlpFuncVFSFileSeek, /* 0x5a */ + dlpFuncVFSFileResize, /* 0x5b */ + dlpFuncVFSFileSize, /* 0x5c */ + + /* DLP 1.4 functions added here (Palm OS 5.2+, ie Tapwave Zodiac) */ + dlpFuncExpSlotMediaType, /* 0x5d */ + dlpFuncWriteRecordEx, /* 0x5e - function to write >64k records in Tapwave */ + dlpFuncWriteResourceEx, /* 0x5f - function to write >64k resources in Tapwave */ + dlpFuncReadRecordEx, /* 0x60 - function to read >64k records by index in Tapwave */ + dlpFuncUnknown1, /* 0x61 (may be bogus definition in tapwave headers, is listed as dlpFuncReadRecordStream)*/ + dlpFuncUnknown3, /* 0x62 */ + dlpFuncUnknown4, /* 0x63 */ + dlpFuncReadResourceEx, /* 0x64 - function to read resources >64k by index in Tapwave */ + dlpLastFunc +}; + +#endif /* !SWIG */ + +/** @name Database and record attributes */ +/*@{*/ + /** @brief Database flags in DBInfo structure and also for dlp_CreateDB() */ + enum dlpDBFlags { + dlpDBFlagResource = 0x0001, /**< Resource database */ + dlpDBFlagReadOnly = 0x0002, /**< Database is read only */ + dlpDBFlagAppInfoDirty = 0x0004, /**< AppInfo data has been modified */ + dlpDBFlagBackup = 0x0008, /**< Database should be backed up during HotSync */ + dlpDBFlagHidden = 0x0100, /**< Database is hidden */ + dlpDBFlagLaunchable = 0x0200, /**< Database is launchable data (show in Launcher, launch app by Creator) */ + dlpDBFlagRecyclable = 0x0400, /**< Database will be deleted shortly */ + dlpDBFlagBundle = 0x0800, /**< Database is bundled with others having same creator (i.e. for Beam) */ + dlpDBFlagOpen = 0x8000, /**< Database is currently open */ + + /* v2.0 specific */ + dlpDBFlagNewer = 0x0010, /**< Newer version may be installed over open DB (Palm OS 2.0 and later) */ + dlpDBFlagReset = 0x0020, /**< Reset after installation (Palm OS 2.0 and later) */ + + /* v3.0 specific */ + dlpDBFlagCopyPrevention = 0x0040, /**< Database should not be beamed or sent (Palm OS 3.0 and later) */ + dlpDBFlagStream = 0x0080, /**< Database is a file stream (Palm OS 3.0 and later) */ + + /* OS 6+ */ + dlpDBFlagSchema = 0x1000, /**< Schema database (Palm OS 6.0 and later) */ + dlpDBFlagSecure = 0x2000, /**< Secure database (Palm OS 6.0 and later) */ + dlpDBFlagExtended = dlpDBFlagSecure, /**< Set if Schema not set and DB is Extended (Palm OS 6.0 and later) */ + dlpDBFlagFixedUp = 0x4000 /**< Temp flag used to clear DB on write (Palm OS 6.0 and later) */ + }; + + /** @brief Misc. flags in DBInfo structure */ + enum dlpDBMiscFlags { + dlpDBMiscFlagExcludeFromSync = 0x80, /**< DLP 1.1 and later: exclude this database from sync */ + dlpDBMiscFlagRamBased = 0x40 /**< DLP 1.2 and later: this database is in RAM */ + }; + + /** @brief Database record attributes */ + enum dlpRecAttributes { + dlpRecAttrDeleted = 0x80, /**< Tagged for deletion during next sync */ + dlpRecAttrDirty = 0x40, /**< Record modified */ + dlpRecAttrBusy = 0x20, /**< Record locked (in use) */ + dlpRecAttrSecret = 0x10, /**< Record is secret */ + dlpRecAttrArchived = 0x08 /**< Tagged for archival during next sync */ + }; + + /** @brief Mode flags used in dlp_OpenDB() */ + enum dlpOpenFlags { + dlpOpenRead = 0x80, /**< Open database for reading */ + dlpOpenWrite = 0x40, /**< Open database for writing */ + dlpOpenExclusive = 0x20, /**< Open database with exclusive access */ + dlpOpenSecret = 0x10, /**< Show secret records */ + dlpOpenReadWrite = 0xC0 /**< Open database for reading and writing (equivalent to (#dlpOpenRead | #dlpOpenWrite)) */ + }; + + /** @brief Flags passed to dlp_ReadDBList() */ + enum dlpDBList { + dlpDBListRAM = 0x80, /**< List RAM databases */ + dlpDBListROM = 0x40, /**< List ROM databases */ + dlpDBListMultiple = 0x20 /**< DLP 1.2 and above: list as many databases as possible at once */ + }; + + enum dlpFindDBOptFlags { + dlpFindDBOptFlagGetAttributes = 0x80, + dlpFindDBOptFlagGetSize = 0x40, + dlpFindDBOptFlagMaxRecSize = 0x20 + }; + + enum dlpFindDBSrchFlags { + dlpFindDBSrchFlagNewSearch = 0x80, + dlpFindDBSrchFlagOnlyLatest = 0x40 + }; + +/*@}*/ + +/** @brief End status values for dlp_EndOfSync() */ +enum dlpEndStatus { + dlpEndCodeNormal = 0, /**< Normal termination */ + dlpEndCodeOutOfMemory, /**< End due to low memory on device */ + dlpEndCodeUserCan, /**< Cancelled by user */ + dlpEndCodeOther /**< dlpEndCodeOther and higher == "Anything else" */ +}; + +/** @name Expansion manager and VFS manager constants */ +/*@{*/ + /** @brief Expansion card capabilities, as returned by dlp_ExpCardInfo() */ + enum dlpExpCardCapabilities { + dlpExpCapabilityHasStorage = 0x00000001, /**< Card supports reading (and maybe writing) */ + dlpExpCapabilityReadOnly = 0x00000002, /**< Card is read-only */ + dlpExpCapabilitySerial = 0x00000004 /**< Card supports dumb serial interface */ + }; + + /** @brief VFS volume attributes as found in the @a attributes member of a VFSInfo structure */ + enum dlpVFSVolumeAttributes { + vfsVolAttrSlotBased = 0x00000001, /**< Volume is inserted is an expansion slot */ + vfsVolAttrReadOnly = 0x00000002, /**< Volume is read-only */ + vfsVolAttrHidden = 0x00000004 /**< Volume is hidden */ + }; + + /** @brief Constants for dlp_VFSFileSeek() */ + enum dlpVFSSeekConstants { + vfsOriginBeginning = 0, /**< From the beginning (first data byte of file) */ + vfsOriginCurrent = 1, /**< from the current position */ + vfsOriginEnd = 2 /**< From the end of file (one position beyond last data byte, only negative offsets are legally allowed) */ + }; + + /** @brief Flags for dlp_VFSFileOpen() */ + enum dlpVFSOpenFlags { + dlpVFSOpenExclusive = 0x01, /**< For dlp_VFSFileOpen(). Exclusive access */ + dlpVFSOpenRead = 0x02, /**< For dlp_VFSFileOpen(). Read only */ + dlpVFSOpenWrite = 0x05, /**< For dlp_VFSFileOpen(). Write only. Implies exclusive */ + dlpVFSOpenReadWrite = 0x07, /**< For dlp_VFSFileOpen(). Read | write */ + + /* Remainder are aliases and special cases not for VFSFileOpen */ + vfsModeExclusive = dlpVFSOpenExclusive, /**< Alias to #dlpVFSOpenExclusive */ + vfsModeRead = dlpVFSOpenRead, /**< Alias to #dlpVFSOpenRead */ + vfsModeWrite = dlpVFSOpenWrite, /**< Alias to #dlpVFSOpenWrite */ + vfsModeReadWrite = vfsModeRead | vfsModeWrite, /**< Alias to #dlpVFSOpenReadWrite */ + vfsModeCreate = 0x08 /**< Not for dlp_VFSFileOpen(). Create file if it doesn't exist. */, + vfsModeTruncate = 0x10 /**< Not for dlp_VFSFileOpen(). Truncate to 0 bytes on open. */, + vfsModeLeaveOpen = 0x20 /**< Not for dlp_VFSFileOpen(). Leave file open even if foreground task closes. */ + } ; + + /** @brief VFS file attribute constants */ + enum dlpVFSFileAttributeConstants { + vfsFileAttrReadOnly = 0x00000001, /**< File is read only */ + vfsFileAttrHidden = 0x00000002, /**< File is hidden */ + vfsFileAttrSystem = 0x00000004, /**< File is a system file */ + vfsFileAttrVolumeLabel = 0x00000008, /**< File is the volume label */ + vfsFileAttrDirectory = 0x00000010, /**< File is a directory */ + vfsFileAttrArchive = 0x00000020, /**< File is archived */ + vfsFileAttrLink = 0x00000040 /**< File is a link to another file */ + }; + + /** @brief Constants for dlp_VFSFileGetDate() and dlp_VFSFileSetDate() */ + enum dlpVFSDateConstants { + vfsFileDateCreated = 1, /**< The date the file was created. */ + vfsFileDateModified = 2, /**< The date the file was last modified. */ + vfsFileDateAccessed = 3 /**< The date the file was last accessed. */ + }; + + /** @brief VFS file iterator constants */ + enum dlpVFSFileIteratorConstants { + vfsIteratorStart = 0, /** < Indicates that iterator is beginning */ + vfsIteratorStop = -1 /**< Indicate that iterator has gone through all items */ + }; +/*@}*/ + + +/** @brief Error codes returned by DLP transactions + * + * After a DLP transaction, there may be a DLP or Palm OS error + * if the result code is #PI_ERR_DLP_PALMOS. In this case, use + * pi_palmos_error() to obtain the error code. It can be in the + * DLP error range (0 > error < #dlpErrLastError), or otherwise + * in the Palm OS error range (see Palm OS header files for + * definitions, in relation with each DLP call) + */ +enum dlpErrors { + dlpErrNoError = 0, /**< No error */ + dlpErrSystem, /**< System error (0x0001) */ + dlpErrIllegalReq, /**< Illegal request, not supported by this version of DLP (0x0002) */ + dlpErrMemory, /**< Not enough memory (0x0003) */ + dlpErrParam, /**< Invalid parameter (0x0004) */ + dlpErrNotFound, /**< File, database or record not found (0x0005) */ + dlpErrNoneOpen, /**< No file opened (0x0006) */ + dlpErrAlreadyOpen, /**< File already open (0x0007) */ + dlpErrTooManyOpen, /**< Too many open files (0x0008) */ + dlpErrExists, /**< File already exists (0x0009) */ + dlpErrOpen, /**< Can't open file (0x000a) */ + dlpErrDeleted, /**< File deleted (0x000b) */ + dlpErrBusy, /**< Record busy (0x000c) */ + dlpErrNotSupp, /**< Call not supported (0x000d) */ + dlpErrUnused1, /**< @e Unused (0x000e) */ + dlpErrReadOnly, /**< File is read-only (0x000f) */ + dlpErrSpace, /**< Not enough space left on device (0x0010) */ + dlpErrLimit, /**< Limit reached (0x0011) */ + dlpErrSync, /**< Sync error (0x0012) */ + dlpErrWrapper, /**< Wrapper error (0x0013) */ + dlpErrArgument, /**< Invalid argument (0x0014) */ + dlpErrSize, /**< Invalid size (0x0015) */ + + dlpErrUnknown = 127 /**< Unknown error (0x007F) */ +}; + + +#ifndef SWIG /* no need to clutter the bindings with this */ + +/** @brief Internal DLP argument structure */ +struct dlpArg { + int id_; /**< Argument ID (start at #PI_DLP_ARG_FIRST_ID) */ + size_t len; /**< Argument length */ + char *data; /**< Argument data */ +}; + +/** @brief Internal DLP command request structure */ +struct dlpRequest { + enum dlpFunctions cmd; /**< Command ID */ + int argc; /**< Number of arguments */ + struct dlpArg **argv; /**< Ptr to arguments */ +}; + +/** @brief Internal DLP command response structure */ +struct dlpResponse { + enum dlpFunctions cmd; /**< Command ID as returned by device. If not the same than requested command, this is an error */ + enum dlpErrors err; /**< DLP error (see #dlpErrors enum) */ + int argc; /**< Number of response arguments */ + struct dlpArg **argv; /**< Response arguments */ +}; + +#endif /* !SWIG */ + +/* @name Functions used internally by dlp.c */ +/*@{*/ +#ifndef SWIG /* don't export these functions to bindings */ + extern struct dlpArg * dlp_arg_new PI_ARGS((int id_, size_t len)); + extern void dlp_arg_free PI_ARGS((struct dlpArg *arg)); + extern int dlp_arg_len PI_ARGS((int argc, struct dlpArg **argv)); + + extern struct dlpRequest *dlp_request_new + PI_ARGS((enum dlpFunctions cmd, int argc, ...)); + extern struct dlpRequest * dlp_request_new_with_argid + PI_ARGS((enum dlpFunctions cmd, int argid, int argc, ...)); + extern void dlp_request_free PI_ARGS((struct dlpRequest *req)); + + extern struct dlpResponse *dlp_response_new + PI_ARGS((enum dlpFunctions cmd, int argc)); + extern ssize_t dlp_response_read PI_ARGS((struct dlpResponse **res, + int sd)); + extern ssize_t dlp_request_write PI_ARGS((struct dlpRequest *req, + int sd)); + extern void dlp_response_free PI_ARGS((struct dlpResponse *req)); + + extern int dlp_exec PI_ARGS((int sd, struct dlpRequest *req, + struct dlpResponse **res)); + + extern char *dlp_errorlist[]; + extern char *dlp_strerror(int error); + + struct RPC_params; + extern int dlp_RPC + PI_ARGS((int sd, struct RPC_params * p, + unsigned long *result)); +#endif /* !SWIG */ +/*@}*/ + +/** @name DLP library functions */ +/*@{*/ + /** @brief Set the version of the DLP protocol we report to the device. + * + * During the handshake phase, the device and the desktop exchange the + * version of the DLP protocol both support. If the device's DLP version + * is higher than the desktop's, the device usually refuses to connect. + * + * @note Call this function prior to accepting or initiating a connection. + * + * @param major Protocol major version + * @param minor Protocol minor version + */ + extern void dlp_set_protocol_version + PI_ARGS((int major, int minor)); + + /** @brief Convert a Palm OS date to a local date + * + * Local dates are using the local machine's timezone. If the Palm OS date + * is undefined, the local date is set to @c 0x83DAC000 (Fri Jan 1 00:00:00 1904 GMT) + * + * @param timeDateData Ptr to a time/date data block returned by Palm OS + * @return converted date + */ + extern time_t dlp_ptohdate PI_ARGS((PI_CONST unsigned char *timeDateData)); + + /** @brief Convert a date to Palm OS date + * + * If the local date is @c 0x83DAC000 (Fri Jan 1 00:00:00 1904 GMT) the Palm OS date + * is set to undefined. Otherwise the date is converted from local time to Palm OS + * + * @param palm_time The date to convert + * @param timeDateData Ptr to an 8 byte buffer to hold the Palm OS date + */ + extern void dlp_htopdate PI_ARGS((time_t palm_time, unsigned char *timeDateData)); +/*@}*/ + +/** @name System functions */ +/*@{*/ + /** @brief Get the time from the device and return it as a local time_t value + * + * @param sd Socket number + * @param palm_time Pointer to a time_t to fill + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_GetSysDateTime PI_ARGS((int sd, time_t *palm_time)); + + /** @brief Set the time on the Palm using a local time_t value. + * + * @param sd Socket number + * @param palm_time New time to set the device to (expressed using the computer's timezone) + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_SetSysDateTime PI_ARGS((int sd, time_t palm_time)); + + /** @brief Read the system information block + * + * @param sd Socket number + * @param sysinfo Returned system information + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadSysInfo PI_ARGS((int sd, struct SysInfo *sysinfo)); + + /** @brief Read information about internal handheld memory + * + * @param sd Socket number + * @param cardno Card number (zero based) + * @param cardinfo Returned information about the memory card. + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadStorageInfo + PI_ARGS((int sd, int cardno, struct CardInfo *cardinfo)); + + /** @brief Read the device user information + * + * @param sd Socket number + * @param user Returned user info + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadUserInfo + PI_ARGS((int sd, struct PilotUser *user)); + + /** @brief Change the device user information + * + * @param sd Socket number + * @param INPUT New user info + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_WriteUserInfo + PI_ARGS((int sd, PI_CONST struct PilotUser *INPUT)); + + /** @brief Convenience function to reset lastSyncPC in the UserInfo to 0 + * + * @param sd Socket number + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ResetLastSyncPC PI_ARGS((int sd)); + + /** @brief Read Network HotSync information + * + * Supported on Palm OS 2.0 and later. + * + * @param sd Socket number + * @param OUTPUT On return, filled NetSyncInfo structure + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadNetSyncInfo + PI_ARGS((int sd, struct NetSyncInfo *OUTPUT)); + + /** @brief Set Network HotSync information + * + * Supported on Palm OS 2.0 and later + * + * @param sd Socket number + * @param INPUT NetSyncInfo structure to set + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_WriteNetSyncInfo + PI_ARGS((int sd, PI_CONST struct NetSyncInfo *INPUT)); + + /** @brief State that a conduit has started running on the desktop + * + * Puts up a status message on the device. Calling this method regularly + * is also the only reliable way to know whether the user pressed the Cancel + * button on the device. + * + * @param sd Socket number + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_OpenConduit PI_ARGS((int sd)); + + /** @brief Terminate connection with the device + * + * Required at the end of a session. The pi_socket layer + * will call this for you if you don't. After the device receives this + * command, it will terminate the connection. + * + * @param sd Socket number + * @param status End of sync status (see #dlpEndStatus enum) + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_EndOfSync PI_ARGS((int sd, int status)); + + /** @brief Terminate HotSync _without_ notifying Palm. + * + * This will cause the Palm to time out, and should (if I remember right) + * lose any changes to unclosed databases. _Never_ use under ordinary + * circumstances. If the sync needs to be aborted in a reasonable + * manner, use EndOfSync with a non-zero status. + * + * @param sd Socket number + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_AbortSync PI_ARGS((int sd)); + + /** @brief Read a Feature from the device + * + * @param sd Socket number + * @param creator Feature creator + * @param num Feature number + * @param feature On return, the feature value + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadFeature + PI_ARGS((int sd, unsigned long creator, int num, + unsigned long *feature)); + + /** @brief Emulation of the SysGetROMToken function on the device + * + * Supported on Palm OS 2.0 through 4.0. Using this function + * is not recommended. + * + * @warning This function uses 68K RPC calls to perform its duty, + * and is therefore not supported on devices running Palm OS 5.0 + * and later. Actually, it may even crash the device. + * + * @param sd Socket number + * @param token ROM token to read + * @param databuf Buffer to store the token data in + * @param datasize Size of data to read + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_GetROMToken + PI_ARGS((int sd, unsigned long token, void *databuf, size_t *datasize)); + + /** @brief Add an entry into the HotSync log on the device + * + * Move to the next line with \\n, as usual. You may invoke this + * command once or more before calling dlp_EndOfSync(), but it is + * not required. + * + * @param sd Socket number + * @param string Nul-terminated string with the text to insert in the log + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_AddSyncLogEntry PI_ARGS((int sd, char *string)); + + /** @brief Call an application on the device + * + * 32-bit retcode and data over 64k only supported on Palm OS 2.0 and later. + * + * This function allows calling an application (or any PRC that responds + * to launch codes) using a custom launch code and custom data. The + * application can return data too, using DlkControl() and the + * dlkCtlSendCallAppReply selector. See Palm OS documentation for more + * information. + * + * @param sd Socket number + * @param creator Creator code of the application to call + * @param type Type code of the application to call + * @param action Launch code to send to the application + * @param datasize Length of data block to pass to the application + * @param databuf Data block to pass to the application + * @param retcode On return, result code returned by the application + * @param retbuf Buffer allocated using pi_buffer_new(). On return contains the data returned by the application + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_CallApplication + PI_ARGS((int sd, unsigned long creator, unsigned long type, + int action, size_t datasize, PI_CONST void *databuf, + unsigned long *retcode, pi_buffer_t *retbuf)); + + /** @brief Convenience function to ead an app preference data block + * + * Supported on Palm OS 2.0 and later, emulated for Palm OS 1.x. + * + * @param sd Socket number + * @param creator Application creator + * @param prefid Preference ID + * @param backup If set, read from backup prefs (see Palm OS documentation). This flag is ignored on Palm OS 1.x. + * @param maxsize Maximum size of the data to return in buffer + * @param databuf If not NULL, buffer should be of size @p maxsize. On return, contains the preference data + * @param datasize If not NULL, on return contains the size of the preference data block + * @param version If not NULL + * @return A negative value if an error occured (see pi-error.h), otherwise the size of the preference block + */ + extern PI_ERR dlp_ReadAppPreference + PI_ARGS((int sd, unsigned long creator, int prefid, int backup, + int maxsize, void *databuf, size_t *datasize, int *version)); + + /** @brief Write an app preference data block + * + * Supported on Palm OS 2.0 and later. Emulated on Palm OS 1.x. + * + * @param sd Socket number + * @param creator Application creator + * @param prefid Preference ID + * @param backup If set, write to backup prefs (see Palm OS documentation). This flag is ignored on Palm OS 1.x. + * @param version Version of the pref to write + * @param databuf Ptr to the data to write + * @param datasize Size of the data to write + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_WriteAppPreference + PI_ARGS((int sd, unsigned long creator, int prefid, int backup, + int version, PI_CONST void *databuf, size_t datasize)); + + /** @brief Require reboot of device after HotSync terminates + * + * @param sd Socket number + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ResetSystem PI_ARGS((int sd)); + +/*@}*/ + +/** @name Database access functions */ +/*@{*/ + /** @brief Read the database list from the device + * + * The database list can be read either one database at a time (slower), + * or passing ::dlpDBListMultiple in the @p flags member. Pass ::dlpDBListRAM + * in @p flags to get the list of databases in RAM, and ::dlpDBListROM to get + * the list of databases in ROM. You can mix flags to obtain the desired + * result. Passing ::dlpDBListMultiple will return several DBInfo + * structures at once (usually 20). Use (info->used / sizeof(DBInfo)) to + * know how many database information blocks were returned. + * For the next call, pass the last DBInfo->index value + 1 to start to + * the next database. @n @n + * When all the database informations have been retrieved, this function returns + * #PI_ERR_DLP_PALMOS and pi_palmos_error() returns #dlpErrNotFound. + * + * @param sd Socket number + * @param cardno Card number (should be 0) + * @param flags Flags (see #dlpDBList enum) + * @param start Index of first database to list (zero based) + * @param dblist Buffer filled with one or more DBInfo structure + * @return A negative value if an error occured or the DB list is exhausted (see pi-error.h) + * + */ + extern PI_ERR dlp_ReadDBList + PI_ARGS((int sd, int cardno, int flags, int start, + pi_buffer_t *dblist)); + + /** @brief Find a database by name + * + * Supported on Palm OS 3.0 (DLP 1.2) and later. + * + * @param sd Socket number + * @param cardno Memory card number (usually 0) + * @param dbname Database name + * @param localid If not NULL, on return contains the LocalID of the database if it was found + * @param dbhandle If not NULL, on return contains the handle of the database if it is currently open + * @param dbInfo If not NULL, on return contains information about the database + * @param dbSize If not NULL, on return contains information about the database size + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_FindDBByName + PI_ARGS((int sd, int cardno, PI_CONST char *dbname, unsigned long *localid, int *dbhandle, + struct DBInfo *dbInfo, struct DBSizeInfo *dbSize)); + + /** @brief Get information about an open database + * + * Supported on Palm OS 3.0 (DLP 1.2) and later. + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param cardno If not NULL, on return contains the cardno of the memory card the database resides on + * @param localid If not NULL, on return contains the LocalID of the database + * @param dbInfo If not NULL, on return contains information about the database + * @param dbSize If not NULL, on return contains information about the database size + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_FindDBByOpenHandle + PI_ARGS((int sd, int dbhandle, int *cardno, unsigned long *localid, + struct DBInfo *dbInfo, struct DBSizeInfo *dbSize)); + + /** @brief Find databases by type and/or creator + * + * Supported on Palm OS 3.0 (DLP 1.2) and later. To look for multiple databases, + * make a first call with @p start set to 1, then subsequent calls with @p start set to 0 + * until no more database is found. + * + * @param sd Socket number + * @param type If not 0, type code to look for + * @param creator If not 0, creator code to look for + * @param start If set, start a new search + * @param latest If set, returns the database with the latest version if there are several identical databases + * @param cardno If not NULL, on return contains the memory card number the database resides on + * @param localid If not NULL, on return contains the LocalID of the database + * @param dbhandle If not NULL, on return contains the handle of the database if it is currently open + * @param dbInfo If not NULL, on return contains information about the database + * @param dbSize If not NULL, on return contains information about the database size + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_FindDBByTypeCreator + PI_ARGS((int sd, unsigned long type, unsigned long creator, int start, + int latest, int *cardno, unsigned long *localid, int *dbhandle, + struct DBInfo *dbInfo, struct DBSizeInfo *dbSize)); + + /** @brief Look for a database on the device + * + * This function does not match any DLP layer function, but is + * intended as a shortcut for programs looking for databases. It + * uses a fairly byzantine mechanism for ordering the RAM databases + * before the ROM ones. You must feed the @a index slot from the + * returned info in @p start the next time round. + * + * @param sd Socket number + * @param cardno Card number (should be 0) + * @param start Index of first database to list (zero based) + * @param dbname If not NULL, look for a database with this name + * @param type If not 0, matching database must have this type + * @param creator If not 0, matching database must have this creator code + * @param OUTPUT Returned database information on success + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_FindDBInfo + PI_ARGS((int sd, int cardno, int start, PI_CONST char *dbname, + unsigned long type, unsigned long creator, + struct DBInfo *OUTPUT)); + + /** @brief Open a database on the Palm. + * + * @param sd Socket number + * @param cardno Card number (should be 0) + * @param mode Open mode (see #dlpOpenFlags enum) + * @param dbname Database name + * @param dbhandle Returned database handle to use if other calls like dlp_CloseDB() + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_OpenDB + PI_ARGS((int sd, int cardno, int mode, PI_CONST char *dbname, + int *dbhandle)); + + /** @brief Close an opened database + * + * @param sd Socket number + * @param dbhandle The DB handle returned by dlp_OpenDB() + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_CloseDB PI_ARGS((int sd, int dbhandle)); + + /** @brief Close all opened databases + * + * @param sd Socket number + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_CloseDB_All PI_ARGS((int sd)); + + /** @brief Delete an existing database from the device + * + * @param sd Socket number + * @param cardno Card number (should be 0) + * @param dbname Database name + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_DeleteDB + PI_ARGS((int sd, int cardno, PI_CONST char *dbname)); + + /** @brief Create database on the device + * + * After creation, the database is open and ready for use. You should + * call dlp_CloseDB() once you're done with the database. + * + * @param sd Socket number + * @param creator Creator code for the new database (four-char code) + * @param type Type code for the new database (four-char code) + * @param cardno Card number (should be 0) + * @param flags Database flags (see #dlpDBFlags enum) + * @param version Database version number + * @param dbname Database name + * @param dbhandle On return, DB handle to pass to other calls like dlp_CloseDB() + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_CreateDB + PI_ARGS((int sd, unsigned long creator, unsigned long type, + int cardno, int flags, unsigned int version, + PI_CONST char *dbname, int *dbhandle)); + + /** @brief Return the number of records in an opened database. + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param numrecs On return, number of records in the database + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadOpenDBInfo + PI_ARGS((int sd, int dbhandle, int *numrecs)); + + /** @brief Change information for an open database + * + * Supported on Palm OS 3.0 (DLP 1.2) and later. + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param flags Flags to set for this database (see #dlpDBFlags enum) + * @param clearFlags Flags to clear for this database (see #dlpDBFlags enum) + * @param version Version of this database + * @param createDate Creation date of this database + * @param modifyDate Modification date of this database (use @c 0x83DAC000 to unset) + * @param backupDate Last backup date of this database (use @c 0x83DAC000 to unset) + * @param type Database type code (four-char code) + * @param creator Database creator code (four-char code) + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_SetDBInfo + PI_ARGS((int sd, int dbhandle, int flags, int clearFlags, unsigned int version, + time_t createDate, time_t modifyDate, time_t backupDate, + unsigned long type, unsigned long creator)); + + /** @brief Delete a category from a database + * + * Any record in that category will be moved to the Unfiled category. + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param category Category to delete + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_DeleteCategory + PI_ARGS((int sd, int dbhandle, int category)); + + /** @brief Move all records from a category to another category + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param fromcat Category to move from (0-15) + * @param tocat Category to move to (0-15) + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_MoveCategory + PI_ARGS((int sd, int dbhandle, int fromcat, int tocat)); + + /** @brief Read a database's AppInfo block + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param offset Offset to start reading from (0 based) + * @param reqbytes Number of bytes to read (pass -1 to read all data from @p offset to the end of the AppInfo block) + * @param retbuf Buffer allocated using pi_buffer_new(). On return contains the data from the AppInfo block + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadAppBlock + PI_ARGS((int sd, int dbhandle, int offset, int reqbytes, + pi_buffer_t *retbuf)); + + /** @brief Write a database's AppInfo block + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param databuf Pointer to the new AppInfo data. + * @param datasize Length of the new AppInfo data. If 0, the AppInfo block is removed. + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_WriteAppBlock + PI_ARGS((int sd, int dbhandle, PI_CONST void *databuf, size_t datasize)); + + /** @brief Read a database's SortInfo block + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param offset Offset to start reading from (0 based) + * @param reqbytes Number of bytes to read (pass -1 to read all data from @p offset to the end of the SortInfo block) + * @param retbuf Buffer allocated using pi_buffer_new(). On return contains the data from the SortInfo block + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadSortBlock + PI_ARGS((int sd, int dbhandle, int offset, int reqbytes, + pi_buffer_t *retbuf)); + + /** @brief Write a database's SortInfo block + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param databuf Pointer to the new SortInfo data. + * @param datasize Length of the new SortInfo data. If 0, the SortInfo block is removed. + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_WriteSortBlock + PI_ARGS((int sd, int dbhandle, PI_CONST void *databuf, + size_t datasize)); + + /** @brief Clean up a database by removing deleted/archived records + * + * Delete all records in the opened database which are marked as + * archived or deleted. + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_CleanUpDatabase PI_ARGS((int sd, int dbhandle)); + + /** @brief Reset dirty record flags, update sync time + * + * For record databases, reset all dirty flags. For both record and + * resource databases, set the last sync time to now. + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ResetSyncFlags PI_ARGS((int sd, int dbhandle)); + + /** @brief Reset the nextRecord position used in dlp_ReadNextRecInCategory() + * + * This resets the nextRecord both internally and on the device. + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ResetDBIndex PI_ARGS((int sd, int dbhandle)); + + /** @brief Read the list of record IDs from an open database + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param sort If non-zero, the on-device application with the same DB creator will be called to re-sort the records prior to returning the list + * @param start Index of first record ID to return (zero based) + * @param max Maximum number of record IDs to return + * @param recuids On return, @p count record UIDs + * @param count On return, the number of record IDs found in @p IDs + * @return A negative value if an error occured (see pi-error.h) + */ +#ifndef SWIG /* bindings provide a native implementation */ + extern PI_ERR dlp_ReadRecordIDList + PI_ARGS((int sd, int dbhandle, int sort, int start, int max, + recordid_t *recuids, int *count)); +#endif + + /** @brief Read a record using its unique ID + * + * Read a record identified by its unique ID. Make sure you only + * request records that effectively exist in the database (use + * dlp_ReadRecordIDList() to retrieve the unique IDs of all records + * in the database). + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param recuid Record unique ID + * @param retbuf If not NULL, a buffer allocated using pi_buffer_new(). On return, contains the record contents + * @param recindex If not NULL, contains the record index on return. + * @param recattrs If not NULL, contains the record attributes on return. + * @param category If not NULL, contains the record category on return. + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadRecordById + PI_ARGS((int sd, int dbhandle, recordid_t recuid, pi_buffer_t *retbuf, + int *recindex, int *recattrs, int *category)); + + /** @brief Read a record using its index + * + * Read a record by record index (zero-based). Make sure you only + * request records within the bounds of database records + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param recindex Record index (zero based) + * @param retbuf If not NULL, a buffer allocated using pi_buffer_new(). On return, contains the record contents + * @param recuid If not NULL, contains the record UID on return. + * @param recattrs If not NULL, contains the record attributes on return. + * @param category If not NULL, contains the record category on return. + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadRecordByIndex + PI_ARGS((int sd, int dbhandle, int recindex, pi_buffer_t *retbuf, + recordid_t *recuid, int *recattrs, int *category)); + + /** @brief Iterate through modified records in database + * + * Return subsequent modified records on each call. Use dlp_ResetDBIndex() + * prior to starting iterations. Once all the records have been seen, + * this function returns PI_ERR_DLP_PALMOS and pi_palmos_error() returns + * #dlpErrNotFound. + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param retbuf If not NULL, a buffer created using pi_buffer_new(). Buffer is cleared first using pi_buffer_clear(). On return, contains the record data + * @param recuid If not NULL, contains the record unique ID on return + * @param recindex If not NULL, contains the record index on return + * @param recattrs If not NULL, contains the record attributes on return (see #dlpRecAttributes enum) + * @param category If not NULL, contains the record category on return + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadNextModifiedRec + PI_ARGS((int sd, int dbhandle, pi_buffer_t *retbuf, recordid_t *recuid, + int *recindex, int *recattrs, int *category)); + + /** @brief Iterate through modified records in category + * + * Return subsequent modified records on each call. Use dlp_ResetDBIndex() + * prior to starting iterations. Once all the records have been seen, + * this function returns PI_ERR_DLP_PALMOS and pi_palmos_error() returns + * #dlpErrNotFound. + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param category The category to iterate into + * @param retbuf If not NULL, a buffer created using pi_buffer_new(). Buffer is cleared first using pi_buffer_clear(). On return, contains the record data + * @param recuid If not NULL, contains the record unique ID on return + * @param recindex If not NULL, contains the record index on return + * @param recattrs If not NULL, contains the record attributes on return (see #dlpRecAttributes enum) + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadNextModifiedRecInCategory + PI_ARGS((int sd, int dbhandle, int category, pi_buffer_t *retbuf, + recordid_t *recuid, int *recindex, int *recattrs)); + + /** @brief Iterate through records in category + * + * Return subsequent records on each call. Use dlp_ResetDBIndex() + * prior to starting iterations. Once all the records have been seen, + * this function returns PI_ERR_DLP_PALMOS and pi_palmos_error() returns + * #dlpErrNotFound. + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param category The category to iterate into + * @param retbuf If not NULL, a buffer created using pi_buffer_new(). Buffer is cleared first using pi_buffer_clear(). On return, contains the record data + * @param recuid If not NULL, contains the record unique ID on return + * @param recindex If not NULL, contains the record index on return + * @param recattrs If not NULL, contains the record attributes on return (see #dlpRecAttributes enum) + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadNextRecInCategory + PI_ARGS((int sd, int dbhandle, int category, pi_buffer_t *retbuf, + recordid_t *recuid, int *recindex, int *recattrs)); + + /** @brief Create a new record in a database + * + * Use this call to add records to a database. On DLP 1.4 and later, you can create records + * bigger than 64k. Set the record ID to 0 to have the device generate the record ID itself, + * or assign a record ID of your own. Read Palm's documentation for information about + * record IDs, as there is a way to indicate which records were created by the desktop and + * which ones were created by the device applications. + * + * If you pass -1 as the data length, the function will treat the data as a string and use + * strlen(data)+1 as the data length (that is, the string is written including the + * terminating nul character). + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param flags Record attributes (see #dlpRecAttributes enum) + * @param recuid Record ID of the new record. If 0, device will generate a new record ID for this record. + * @param catid Category of the new record + * @param databuf Ptr to record data + * @param datasize Record data length + * @param newrecuid On return, record ID that was assigned to this record + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_WriteRecord + PI_ARGS((int sd, int dbhandle, int flags, recordid_t recuid, + int catid, PI_CONST void *databuf, size_t datasize, + recordid_t *newrecuid)); + + /** @brief Delete an existing record from a database + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param all If set, ALL records are deleted from the database. + * @param recuid Record ID of record to delete if @p all == 0. + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_DeleteRecord + PI_ARGS((int sd, int dbhandle, int all, recordid_t recuid)); + + /** @brief Read a resource identified by its type and ID + * + * @note To read resources larger than 64K, you should use dlp_ReadResourceByIndex(). + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param type Type code for the resource (four-char code) + * @param resid Resource ID + * @param retbuf If not NULL, a buffer allocated using pi_buffer_new(). On return, contains the resource contents + * @param resindex If not NULL, on return contains the resource index + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadResourceByType + PI_ARGS((int sd, int dbhandle, unsigned long type, int resid, + pi_buffer_t *retbuf, int *resindex)); + + /** @brief Read a resource identified by its resource index + * + * This function supports reading resources larger than 64k on + * DLP 1.4 and later (Palm OS 5.2 and later). + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param resindex Resource index + * @param retbuf If not NULL, a buffer allocated using pi_buffer_new(). On return, contains the resource contents + * @param restype If not NULL, on return contains the resource type + * @param resid If not NULL, on return contains the resource ID + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ReadResourceByIndex + PI_ARGS((int sd, int dbhandle, unsigned int resindex, pi_buffer_t *retbuf, + unsigned long *restype, int *resid)); + + /** @brief Create a new resource of overwrite an existing one + * + * This function supports writing resources larger than 64k on + * DLP 1.4 and later (Palm OS 5.2 and later). + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param restype Resource type (four-char code) + * @param resid Resource ID + * @param databuf Ptr to resource data + * @param datasize Length of resource data to write + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_WriteResource + PI_ARGS((int sd, int dbhandle, unsigned long restype, int resid, + PI_CONST void *databuf, size_t datasize)); + + /** @brief Delete a resource or all resources from a resource file + * + * @param sd Socket number + * @param dbhandle Open database handle, obtained from dlp_OpenDB() + * @param all If set, all resources are removed from this database (@p restype and @p resid are ignored) + * @param restype Resource type (four-char code) + * @param resid Resource ID + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_DeleteResource + PI_ARGS((int sd, int dbhandle, int all, unsigned long restype, + int resid)); +/*@}*/ + +/** @name Expansion manager functions */ +/*@{*/ + /** @brief Enumerate expansion slots + * + * Supported on Palm OS 4.0 and later. Expansion slots are physical slots + * present on the device. To check whether a card is inserted in a slot, + * use dlp_ExpCardPresent(). + * + * @param sd Socket number + * @param numslots On input, maximum number of slots that can be returned in the slotRefs array. On return, the actual number of slot references returned in @p slotRefs. + * @param slotrefs On return, @p numSlots slot references + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ExpSlotEnumerate + PI_ARGS((int sd, int *numslots, int *slotrefs)); + + /** @brief Checks whether a card is inserted in a slot + * + * Supported on Palm OS 4.0 and later. Returns >=0 if a card + * is inserted in the slot. + * + * @param sd Socket number + * @param slotref The slot reference as returned by dlp_ExpSlotEnumerate(). + * @return A negative value if an error occured (see pi-error.h), >=0 if a card is inserted + */ + extern PI_ERR dlp_ExpCardPresent + PI_ARGS((int sd, int slotref)); + + /** @brief Get information about a removable card inserted in an expansion slot + * + * Supported on Palm OS 4.0 and later. The info strings are returned in a + * single malloc()'ed buffer as a suite of nul-terminated string, one + * after the other. + * + * @param sd Socket number + * @param slotref The slot reference as returned by dlp_ExpSlotEnumerate(). + * @param expflags If not NULL, the card flags (see #dlpExpCardCapabilities enum) + * @param numstrings On return, the number of strings found in the @p strings array + * @param strings If not NULL, ptr to a char*. If there are strings to return, this function allocates a buffer to hold the strings. You are responsible for free()'ing the buffer once you're done with it. + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ExpCardInfo + PI_ARGS((int sd, int slotref, unsigned long *expflags, + int *numstrings, char **strings)); + + /** @brief Return the type of media supported by an expansion slot + * + * Supported on Palm OS 5.2 and later (DLP 1.4 and later). + * + * @param sd Socket number + * @param slotref The slot reference as returned by dlp_ExpSlotEnumerate(). + * @param mediatype On return, the media type + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_ExpSlotMediaType + PI_ARGS((int sd, int slotref, unsigned long *mediatype)); +/*@}*/ + +/** @name VFS manager functions */ +/*@{*/ + /** @brief Returns a list of connected VFS volumes + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param numvols On input, the maximum number of volume references that can be returned. On output, the actual number of volume references + * @param volrefs On output, @p numVols volume references + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSVolumeEnumerate + PI_ARGS((int sd, int *numvols, int *volrefs)); + + /** @brief Returns information about a VFS volume + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param volref Volume reference number (obtained from dlp_VFSVolumeEnumerate()) + * @param volinfo On return, volume information + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSVolumeInfo + PI_ARGS((int sd, int volref, struct VFSInfo *volinfo)); + + /** @brief Return the label (name) of a VFS volume + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param volref Volume reference number (obtained from dlp_VFSVolumeEnumerate()) + * @param len On input, the maximum size of the name buffer. On output, the name length (including the ending nul byte) + * @param name On output, the nul-terminated volume name + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSVolumeGetLabel + PI_ARGS((int sd, int volref, int *len, char *name)); + + /** @brief Change the label (name) of a VFS volume + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param volref Volume reference number (obtained from dlp_VFSVolumeEnumerate()) + * @param name New volume name + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSVolumeSetLabel + PI_ARGS((int sd, int volref, PI_CONST char *name)); + + /** @brief Return the total and used size of a VFS volume + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param volref Volume reference number (obtained from dlp_VFSVolumeEnumerate()) + * @param usedbytes On return, number of bytes used on the volume + * @param totalbytes On return, total size of the volume in bytes + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSVolumeSize + PI_ARGS((int sd, int volref, long *usedbytes, long *totalbytes)); + + /** @brief Format a VFS volume + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param fmtflags Format flags (undocumented for now) + * @param fsLibRef File system lib ref (undocumented for now) + * @param param Slot mount parameters (undocumented for now) + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSVolumeFormat + PI_ARGS((int sd, unsigned char fmtflags, int fsLibRef, + struct VFSSlotMountParam *param)); + + /** @brief Get the default storage directory for a given file type + * + * Supported on Palm OS 4.0 and later. Return the default directory + * for a file type. File types as expressed as MIME types, for + * example "image/jpeg", or as a simple file extension (i.e. ".jpg") + * + * @param sd Socket number + * @param volref Volume reference number (obtained from dlp_VFSVolumeEnumerate()) + * @param name MIME type to get the default directory for + * @param dir A buffer to hold the default path + * @param len On input, the length of the @p dir buffer. On return, contains the length of the path string (including the nul terminator) + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSGetDefaultDir + PI_ARGS((int sd, int volref, PI_CONST char *name, + char *dir, int *len)); + + /** @brief Iterate through the entries in a directory + * + * Supported on Palm OS 4.0 and later. At the beginning you set + * @p dirIterator to #vfsIteratorStart, then call this function + * repeatedly until it returns an error code of the iterator becomes + * #vfsIteratorStop. + * + * @bug On some early OS 5 devices like Tungsten T and Sony NX70, NX73 this + * call crashes the device. This has been confirmed to be a bug in HotSync on + * the device, as tests showed that a regular HotSync conduit does crash the + * device with this call too. + * + * @param sd Socket number + * @param dirref Directory reference obtained from dlp_VFSFileOpen() + * @param diriterator Ptr to an iterator. Start with #vfsIteratorStart + * @param maxitems On input, the max number of VFSDirInfo structures stored in @p dirItems. On output, the actual number of items. + * @param diritems Preallocated array that contains a number of VFSDirInfo structures on return. + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSDirEntryEnumerate + PI_ARGS((int sd, FileRef dirref, unsigned long *diriterator, + int *maxitems, struct VFSDirInfo *diritems)); + + /** @brief Create a new directory on a VFS volume + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param volref Volume reference number (obtained from dlp_VFSVolumeEnumerate()) + * @param path Full path for the directory to create + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSDirCreate + PI_ARGS((int sd, int volref, PI_CONST char *path)); + + /** @brief Import a VFS file to a database on the handheld + * + * Supported on Palm OS 4.0 and later. The file is converted to a + * full fledged database and stored in the handheld's RAM. + * + * @param sd Socket number + * @param volref Volume reference number (obtained from dlp_VFSVolumeEnumerate()) + * @param pathname Path of the file to transfer to the handheld + * @param cardno On return, card number the database was created on (usually 0) + * @param localid On return, LocalID of the database that was created + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSImportDatabaseFromFile + PI_ARGS((int sd, int volref, PI_CONST char *pathname, + int *cardno, unsigned long *localid)); + + /** @brief Export a database to a VFS file + * + * Supported on Palm OS 4.0 and later. The database is converted to a + * .prc, .pdb or .pqa file on the VFS volume. + * + * @param sd Socket number + * @param volref Volume reference number (obtained from dlp_VFSVolumeEnumerate()) + * @param pathname Path of the file to create on the VFS volume + * @param cardno Card number the database resides on (usually 0) + * @param localid LocalID of the database to export + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSExportDatabaseToFile + PI_ARGS((int sd, int volref, PI_CONST char *pathname, + int cardno, unsigned int localid)); + + /** @brief Create a new file on a VFS volume + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param volref Volume reference number (obtained from dlp_VFSVolumeEnumerate()) + * @param pathname Full path of the file to create + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSFileCreate + PI_ARGS((int sd, int volref, PI_CONST char *pathname)); + + /** @brief Open an existing file on a VFS volume + * + * Supported on Palm OS 4.0 and later. On some devices, it is required to open the + * file using the #dlpOpenReadWrite mode to be able to write to it (using + * #dlpOpenWrite is not enough). + * + * @param sd Socket number + * @param volref Volume reference number (obtained from dlp_VFSVolumeEnumerate()) + * @param path Full path of the file to open + * @param mode Open mode flags (see #dlpVFSOpenFlags enum) + * @param fileref On return, file reference to the open file + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSFileOpen + PI_ARGS((int sd, int volref, PI_CONST char *path, int mode, + FileRef *fileref)); + + /** @brief Close an open VFS file + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param fileref File reference obtained from dlp_VFSFileOpen() + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSFileClose + PI_ARGS((int sd, FileRef fileref)); + + /** @brief Write data to an open file + * + * Supported on Palm OS 4.0 and later. Will return the number of bytes + * written if successful. + * + * @param sd Socket number + * @param fileref File reference obtained from dlp_VFSFileOpen() + * @param databuf Ptr to the data to write + * @param datasize Length of the data to write + * @return A negative value if an error occured (see pi-error.h), the number of bytes written otherwise. + */ + extern PI_ERR dlp_VFSFileWrite + PI_ARGS((int sd, FileRef fileref, PI_CONST void *databuf, size_t datasize)); + + /** @brief Read data from an open file + * + * Supported on Palm OS 4.0 and later. Will return the total number of bytes + * actually read. + * + * @param sd Socket number + * @param fileref File reference obtained from dlp_VFSFileOpen() + * @param retbuf Buffer allocated using pi_buffer_new(). Buffer is being emptied first with pi_buffer_clear(). On return contains the data read from the file. + * @param reqbytes Number of bytes to read from the file. + * @return A negative value if an error occured (see pi-error.h), or the total number of bytes read + */ + extern PI_ERR dlp_VFSFileRead + PI_ARGS((int sd, FileRef fileref, pi_buffer_t *retbuf, size_t reqbytes)); + + /** @brief Delete an existing file from a VFS volume + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param volref Volume reference number (obtained from dlp_VFSVolumeEnumerate()) + * @param pathname Full access path to the file to delete + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSFileDelete + PI_ARGS((int sd, int volref, PI_CONST char *pathname)); + + /** @brief Rename an existing file + * + * Supported on Palm OS 4.0 and later. + * + * @note This function can NOT be used to move a file from one place + * to another. You can only rename a file that will stay in the same + * directory. + * + * @param sd Socket number + * @param volref Volume reference number (obtained from dlp_VFSVolumeEnumerate()) + * @param pathname Full access path to the file to rename + * @param newname New file name, without the rest of the access path + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSFileRename + PI_ARGS((int sd, int volref, PI_CONST char *pathname, + PI_CONST char *newname)); + + /** @brief Checks whether the current position is at the end of file + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param fileref File reference obtained from dlp_VFSFileOpen() + * @return A negative value if an error occured (see pi-error.h). 0 if not at EOF, >0 if at EOF. + */ + extern PI_ERR dlp_VFSFileEOF + PI_ARGS((int sd, FileRef fileref)); + + /** @brief Return the current seek position in an open file + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param fileref File reference obtained from dlp_VFSFileOpen() + * @param position On return, current absolute position in the file + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSFileTell + PI_ARGS((int sd, FileRef fileref, int *position)); + + /** @brief Return the attributes of an open file + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param fileref File reference obtained from dlp_VFSFileOpen() + * @param fileattrs On return, file attributes (see #dlpVFSFileAttributeConstants enum) + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSFileGetAttributes + PI_ARGS((int sd, FileRef fileref, unsigned long *fileattrs)); + + /** @brief Change the attributes of an open file + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param fileref File reference obtained from dlp_VFSFileOpen() + * @param fileattrs n-New file attributes (see #dlpVFSFileAttributeConstants enum) + * @return A negative value if an error occured (see pi-error.h). + */ + extern PI_ERR dlp_VFSFileSetAttributes + PI_ARGS((int sd, FileRef fileref, unsigned long fileattrs)); + + /** @brief Return one of the dates associated with an open file or directory + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param fileref File or directory reference obtained from dlp_VFSFileOpen() + * @param which The date you want (see #dlpVFSDateConstants enum) + * @param date On return, the requested date + * @return A negative value if an error occured (see pi-error.h). + */ + extern PI_ERR dlp_VFSFileGetDate + PI_ARGS((int sd, FileRef fileref, int which, time_t *date)); + + /** @brief Change one of the dates for an open file or directory + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param fileref File or directory reference obtained from dlp_VFSFileOpen() + * @param which The date you want to change (see #dlpVFSDateConstants enum) + * @param date The new date to set + * @return A negative value if an error occured (see pi-error.h). + */ + extern PI_ERR dlp_VFSFileSetDate + PI_ARGS((int sd, FileRef fileref, int which, time_t date)); + + /** @brief Change the current seek position in an open file + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param fileref File or directory reference obtained from dlp_VFSFileOpen() + * @param origin Where to seek from (see #dlpVFSSeekConstants enum) + * @param offset Seek offset + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSFileSeek + PI_ARGS((int sd, FileRef fileref, int origin, int offset)); + + /** @brief Resize an open file + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param fileref File or directory reference obtained from dlp_VFSFileOpen() + * @param newsize New file size + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSFileResize + PI_ARGS((int sd, FileRef fileref, int newsize)); + + /** @brief Return the size of an open file + * + * Supported on Palm OS 4.0 and later. + * + * @param sd Socket number + * @param fileref File or directory reference obtained from dlp_VFSFileOpen() + * @param size On return, the actual size of the file + * @return A negative value if an error occured (see pi-error.h) + */ + extern PI_ERR dlp_VFSFileSize + PI_ARGS((int sd, FileRef fileref, int *size)); +/*@}*/ + +#ifdef __cplusplus +} +#endif +#endif /*_PILOT_DLP_H_*/ diff --git a/pilot-link/pi-error.h b/pilot-link/pi-error.h new file mode 100644 index 000000000..cb30b8f11 --- /dev/null +++ b/pilot-link/pi-error.h @@ -0,0 +1,95 @@ +/* + * $Id: pi-error.h,v 1.1 2007/07/21 03:54:52 robertl Exp $ + * + * pi-error.h: definitions for errors returned by the SOCKET, DLP and + * FILE layers + * + * Copyright (c) 2004-2005, Florent Pillet. + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library + * General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; if not, write to the Free Software Foundation, + * * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _PILOT_ERROR_H_ +#define _PILOT_ERROR_H_ + +/** @file pi-error.h + * @brief Error definitions for the errors returned by libpisock's dlp_XXX functions. + * + * Most dlp_XXX functions return a value that is >= if the function + * succeeded, or < 0 if there was an error. The error code can be directly + * tested, and can also be retrieved using pi_error(). If the error code is + * #PI_ERR_DLP_PALMOS, you should read the error code returned by the device + * using pi_palmos_error(). + * + * @note These error codes are tailored to not conflict with dlpErr* codes + * defined in dlp.h, and which can be checked using pi_palmos_error() + * + */ + +/** @brief Type definition for error returned by various function. + * + * The reason we have a typedef is mostly for swig-generated bindings to + * properly handle result codes + */ + +/**< Type for result codes returned by various library functions (mainly for swig-generated bindings) */ +typedef int PI_ERR; + +/** @brief Definition of errors returned by various libpisock functions */ +enum dlpErrorDefinitions { + /* PROTOCOL level errors */ + PI_ERR_PROT_ABORTED = -100, /**< aborted by other end */ + PI_ERR_PROT_INCOMPATIBLE = -101, /**< can't talk with other end */ + PI_ERR_PROT_BADPACKET = -102, /**< bad packet (used with serial protocols) */ + + /* SOCKET level errors */ + PI_ERR_SOCK_DISCONNECTED = -200, /**< connection has been broken */ + PI_ERR_SOCK_INVALID = -201, /**< invalid protocol stack */ + PI_ERR_SOCK_TIMEOUT = -202, /**< communications timeout (but link not known as broken) */ + PI_ERR_SOCK_CANCELED = -203, /**< last data transfer was canceled */ + PI_ERR_SOCK_IO = -204, /**< generic I/O error */ + PI_ERR_SOCK_LISTENER = -205, /**< socket can't listen/accept */ + + /* DLP level errors */ + PI_ERR_DLP_BUFSIZE = -300, /**< provided buffer is not big enough to store data */ + PI_ERR_DLP_PALMOS = -301, /**< a non-zero error was returned by the device */ + PI_ERR_DLP_UNSUPPORTED = -302, /**< this DLP call is not supported by the connected handheld */ + PI_ERR_DLP_SOCKET = -303, /**< invalid socket */ + PI_ERR_DLP_DATASIZE = -304, /**< requested transfer with data block too large (>64k) */ + PI_ERR_DLP_COMMAND = -305, /**< command error (the device returned an invalid response) */ + + /* FILE level error */ + PI_ERR_FILE_INVALID = -400, /**< invalid prc/pdb/pqa/pi_file file */ + PI_ERR_FILE_ERROR = -401, /**< generic error when reading/writing file */ + PI_ERR_FILE_ABORTED = -402, /**< file transfer was aborted by progress callback, see pi_file_retrieve(), pi_file_install(), pi_file_merge() */ + PI_ERR_FILE_NOT_FOUND = -403, /**< record or resource not found */ + PI_ERR_FILE_ALREADY_EXISTS = -404, /**< a record with same UID or resource with same type/ID already exists */ + + /* GENERIC errors */ + PI_ERR_GENERIC_MEMORY = -500, /**< not enough memory */ + PI_ERR_GENERIC_ARGUMENT = -501, /**< invalid argument(s) */ + PI_ERR_GENERIC_SYSTEM = -502 /**< generic system error */ +}; + +/** @name libpisock error management macros */ +/*@{*/ + #define IS_PROT_ERR(error) ((error)<=-100 && (error)>-200) /**< Check whether the error code is at protocol level */ + #define IS_SOCK_ERR(error) ((error)<=-200 && (error)>-300) /**< Check whether the error code is at socket level */ + #define IS_DLP_ERR(error) ((error)<=-300 && (error)>-400) /**< Check whether the error code is at DLP level */ + #define IS_FILE_ERR(error) ((error)<=-400 && (error)>-500) /**< Check whether the error code os a file error */ + #define IS_GENERIC_ERR(error) ((error)<=-500 && (error)>-600) /**< Check whether the error code is a generic error */ +/*@}*/ + +#endif diff --git a/pilot-link/pi-file.c b/pilot-link/pi-file.c new file mode 100644 index 000000000..e11ec69ab --- /dev/null +++ b/pilot-link/pi-file.c @@ -0,0 +1,1534 @@ +/* + * $Id: pi-file.c,v 1.1 2007/07/21 03:54:52 robertl Exp $ + * + * Pilot File Interface Library + * Pace Willisson December 1996 + * Additions by Kenneth Albanowski + * Additions by Florent Pillet + * + * This is free software, licensed under the GNU Library Public License V2. + * See the file COPYING.LIB for details. + * + * the following is extracted from the combined wisdom of + * PDB by Kevin L. Flynn + * install-prc by Brian J. Swetland, D. Jeff Dionne and Kenneth Albanowski + * makedoc7 by Pat Beirne, + * and the include files from the pilot SDK + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library + * General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +#include +#include +#include +#include +#include +// #include + +#include "pi-debug.h" +#include "pi-source.h" +#include "pi-file.h" +#include "pi-error.h" + +#undef FILEDEBUG +#define pi_mktag(c1,c2,c3,c4) (((c1)<<24)|((c2)<<16)|((c3)<<8)|(c4)) + +/* + header: + 32 name + 2 flags + 2 version + 4 creation time + 4 modification time + 4 backup time + 4 modification number + 4 app info offset + 4 sort info offset + 4 type + 4 creator + 4 uniq id seed (I think it is just garbage) + 4 next record list id (normally 0, or ptr to extended hdr) + 2 num records for this header + + Hypothetically plus 2 more bytes if an extended or perhaps secondary + header (not supported) (In practice, this value is never set, instead it + usually indicates a damaged file.) + + if the low bit of attr is on, then next thing is a list of resource entry + descriptors: + + resource entry header + 4 type + 2 id + 4 offset + + otherwise, if the low bit of attr is off, the next thing is a list of + record entry decriptors: + + record entry header + 4 offset + 1 record attributes + 3 unique id + + then two bytes of unknown purpose, \0\0 seems safe + + next, the app_info, if any, then the sort_info, if any + + then the space used the data. Every offset is an offset from the + beginning of the file, and will point until this area. Each block starts + at the given offset and ends at the beginning of the next block. The last + block ends at the end of the file. + */ + +#define PI_HDR_SIZE 78 +#define PI_RESOURCE_ENT_SIZE 10 +#define PI_RECORD_ENT_SIZE 8 + +/* Local prototypes */ +static int pi_file_close_for_write(pi_file_t *pf); +static void pi_file_free(pi_file_t *pf); +static int pi_file_find_resource_by_type_id(const pi_file_t *pf, unsigned long restype, int resid, int *resindex); +static pi_file_entry_t *pi_file_append_entry(pi_file_t *pf); +static int pi_file_set_rbuf_size(pi_file_t *pf, size_t size); + +/* this seems to work, but what about leap years? */ +/*#define PILOT_TIME_DELTA (((unsigned)(1970 - 1904) * 365 * 24 * 60 * 60) + 1450800)*/ + +/* Exact value of "Jan 1, 1970 0:00:00 GMT" - "Jan 1, 1904 0:00:00 GMT" */ +#define PILOT_TIME_DELTA (unsigned)(2082844800) + + +/* FIXME: These conversion functions apply no timezone correction. UNIX uses + UTC for time_t's, while the Pilot uses local time for database backup + time and appointments, etc. It is not particularly simple to convert + between these in UNIX, especially since the Pilot's local time is + unknown, and if syncing over political boundries, could easily be + different then the local time on the UNIX box. Since the Pilot does not + know what timezone it is in, there is no unambiguous way to correct for + this. + + Worse, the creation date for a program is stored in the local time _of + the computer which did the final linking of that program_. Again, the + Pilot does not store the timezone information needed to reconstruct + where/when this was. + + A better immediate tack would be to dissect these into struct tm's, and + return those. + --KJA + */ +time_t +pilot_time_to_unix_time(unsigned long raw_time) +{ + return (time_t) (raw_time - PILOT_TIME_DELTA); +} + +unsigned long +unix_time_to_pilot_time(time_t t) +{ + return (unsigned long) ((unsigned long) t + PILOT_TIME_DELTA); +} + +pi_file_t +*pi_file_open(const char *name) +// *pi_file_openf(FILE *file) +{ + int i, + file_size; + + pi_file_t *pf; + struct DBInfo *ip; + pi_file_entry_t *entp; + + unsigned char buf[PI_HDR_SIZE]; + unsigned char *p; + off_t offset, app_info_offset = 0, sort_info_offset = 0; + + if ((pf = calloc(1, sizeof (pi_file_t))) == NULL) + return NULL; + + if ((pf->f = fopen(name, "rb")) == NULL) + goto bad; + + fseek(pf->f, 0, SEEK_END); + file_size = ftell(pf->f); + fseek(pf->f, 0, SEEK_SET); + + if (fread(buf, PI_HDR_SIZE, 1, pf->f) != (size_t) 1) { + LOG ((PI_DBG_API, PI_DBG_LVL_ERR, + "FILE OPEN %s: can't read header\n", name)); + goto bad; + } + + p = buf; + ip = &pf->info; + + memcpy(ip->name, p, 32); + ip->flags = get_short(p + 32); + ip->miscFlags = dlpDBMiscFlagRamBased; + ip->version = get_short(p + 34); + ip->createDate = pilot_time_to_unix_time(get_long(p + 36)); + ip->modifyDate = pilot_time_to_unix_time(get_long(p + 40)); + ip->backupDate = pilot_time_to_unix_time(get_long(p + 44)); + ip->modnum = get_long(p + 48); + app_info_offset = get_long(p + 52); + sort_info_offset = get_long(p + 56); + ip->type = get_long(p + 60); + ip->creator = get_long(p + 64); + pf->unique_id_seed = get_long(p + 68); + + /* record list header */ + pf->next_record_list_id = get_long(p + 72); + pf->num_entries = get_short(p + 76); + + LOG ((PI_DBG_API, PI_DBG_LVL_INFO, + "FILE OPEN Name: '%s' Flags: 0x%4.4X Version: %d\n", + ip->name, ip->flags, ip->version)); + LOG ((PI_DBG_API, PI_DBG_LVL_DEBUG, + " Creation date: %s", ctime(&ip->createDate))); + LOG ((PI_DBG_API, PI_DBG_LVL_DEBUG, + " Modification date: %s", ctime(&ip->modifyDate))); + LOG ((PI_DBG_API, PI_DBG_LVL_DEBUG, + " Backup date: %s", ctime(&ip->backupDate))); + LOG ((PI_DBG_API, PI_DBG_LVL_DEBUG, + " Appinfo Size: %d Sortinfo Size: %d\n", + pf->app_info_size, pf->sort_info_size)); + LOG ((PI_DBG_API, PI_DBG_LVL_DEBUG, + " Type: '%s'", printlong(ip->type))); + LOG ((PI_DBG_API, PI_DBG_LVL_DEBUG, + " Creator: '%s' Seed: 0x%8.8lX\n", printlong(ip->creator), + pf->unique_id_seed)); + + if (pf->next_record_list_id != 0) { + LOG ((PI_DBG_API, PI_DBG_LVL_ERR, + "FILE OPEN %s: this file is probably damaged\n", name)); + goto bad; + } + + if (ip->flags & dlpDBFlagResource) { + pf->resource_flag = 1; + pf->ent_hdr_size = PI_RESOURCE_ENT_SIZE; + } else { + pf->resource_flag = 0; + pf->ent_hdr_size = PI_RECORD_ENT_SIZE; + } + + if (pf->num_entries < 0) { + LOG ((PI_DBG_API, PI_DBG_LVL_ERR, + "FILE OPEN %s: bad header\n", name)); + goto bad; + } + + offset = file_size; + + if (pf->num_entries) { + if ((pf->entries = + calloc((size_t)pf->num_entries, + sizeof *pf->entries)) == NULL) + goto bad; + + for (i = 0, entp = pf->entries; i < pf->num_entries; + i++, entp++) { + if (fread(buf, (size_t) pf->ent_hdr_size, 1, pf->f) + != (size_t) 1) + goto bad; + + p = buf; + if (pf->resource_flag) { + entp->type = get_long(p); + entp->resource_id = get_short(p + 4); + entp->offset = get_long(p + 6); + + LOG ((PI_DBG_API, PI_DBG_LVL_DEBUG, + "FILE OPEN Entry %d '%s' #%d @%X\n", i, + printlong(entp->type), entp->resource_id, + entp->offset)); + } else { + entp->offset = get_long(p); + entp->attrs = get_byte(p + 4); + entp->uid = get_treble(p + 5); + + LOG ((PI_DBG_API, PI_DBG_LVL_DEBUG, + "FILE OPEN Entry %d UID: " + "0x%8.8X Attrs: %2.2X Offset: @%X\n", i, + (int) entp->uid, entp->attrs, + entp->offset)); + } + } + + for (i = 0, entp = pf->entries + pf->num_entries - 1; + i < pf->num_entries; i++, entp--) { + entp->size = offset - entp->offset; + offset = entp->offset; + + LOG ((PI_DBG_API, PI_DBG_LVL_DEBUG, + "FILE OPEN Entry: %d Size: %d\n", + pf->num_entries - i - 1, entp->size)); + + if (entp->size < 0 || + (entp->offset + entp->size) > file_size) { + LOG ((PI_DBG_API, PI_DBG_LVL_DEBUG, + "FILE OPEN %s: Entry %d corrupt," + " giving up\n", + name, pf->num_entries - i - 1)); + goto bad; + } + } + } + + if (sort_info_offset) { + pf->sort_info_size = offset - sort_info_offset; + offset = sort_info_offset; + } + + if (app_info_offset) { + pf->app_info_size = offset - app_info_offset; + offset = app_info_offset; + } + + if (pf->app_info_size < 0 || + (sort_info_offset + pf->sort_info_size) > file_size || + pf->sort_info_size < 0 || + (app_info_offset + pf->app_info_size) > file_size) { + LOG ((PI_DBG_API, PI_DBG_LVL_ERR, + "FILE OPEN %s: bad header " + "(app_info @ %d size %d, " + "sort_info @ %d size %d)\n", name, + app_info_offset, pf->app_info_size, + sort_info_offset, pf->sort_info_size)); + goto bad; + } + + if (pf->app_info_size == 0) + pf->app_info = NULL; + else { + if ((pf->app_info = + malloc((size_t) pf->app_info_size)) == NULL) + goto bad; + fseek(pf->f, (long)app_info_offset, SEEK_SET); + if (fread(pf->app_info, 1, (size_t) pf->app_info_size, pf->f) + != (size_t) pf->app_info_size) + goto bad; + } + + if (pf->sort_info_size == 0) + pf->sort_info = NULL; + else { + if ((pf->sort_info = malloc((size_t)pf->sort_info_size)) + == NULL) + goto bad; + fseek(pf->f, (long)sort_info_offset, SEEK_SET); + if (fread(pf->sort_info, 1, (size_t) pf->sort_info_size, + pf->f) != (size_t) pf->sort_info_size) + goto bad; + } + + return pf; + +bad: + pi_file_close(pf); + return NULL; +} + +int +pi_file_close(pi_file_t *pf) +{ + int err; + + if (!pf) + return PI_ERR_FILE_INVALID; + + if (pf->for_writing) + pf->err = pi_file_close_for_write(pf); + + err = pf->err; + + pi_file_free(pf); + + return err; +} + +void +pi_file_get_info(const pi_file_t *pf, struct DBInfo *infop) +{ + *infop = pf->info; +} + +void +pi_file_get_app_info(pi_file_t *pf, void **datap, size_t *sizep) +{ + *datap = pf->app_info; + *sizep = pf->app_info_size; +} + +void +pi_file_get_sort_info(pi_file_t *pf, void **datap, size_t *sizep) +{ + *datap = pf->sort_info; + *sizep = pf->sort_info_size; +} + +int +pi_file_read_resource_by_type_id(pi_file_t *pf, unsigned long restype, + int resid, void **bufp, size_t *sizep, + int *resindex) +{ + int i, + result; + + result = pi_file_find_resource_by_type_id(pf, restype, resid, &i); + if (!result) + return PI_ERR_FILE_NOT_FOUND; + if (resindex) + *resindex = i; + return pi_file_read_resource(pf, i, bufp, sizep, NULL, NULL); +} + +int +pi_file_type_id_used(const pi_file_t *pf, unsigned long restype, int resid) +{ + return pi_file_find_resource_by_type_id(pf, restype, resid, NULL); +} + +int +pi_file_read_resource(pi_file_t *pf, int i, + void **bufp, size_t *sizep, unsigned long *type, + int *idp) +{ + pi_file_entry_t *entp; + int result; + + if (pf->for_writing || !pf->resource_flag) + return PI_ERR_FILE_INVALID; + + if (i < 0 || i >= pf->num_entries) + return PI_ERR_GENERIC_ARGUMENT; + + entp = &pf->entries[i]; + + if (bufp) { + if ((result = pi_file_set_rbuf_size(pf, (size_t) entp->size)) < 0) + return result; + fseek(pf->f, pf->entries[i].offset, SEEK_SET); + if (fread(pf->rbuf, 1, (size_t) entp->size, pf->f) != + (size_t) entp->size) + return PI_ERR_FILE_ERROR; + *bufp = pf->rbuf; + } + + if (sizep) + *sizep = entp->size; + if (type) + *type = entp->type; + if (idp) + *idp = entp->resource_id; + + return 0; +} + +int +pi_file_read_record(pi_file_t *pf, int recindex, + void **bufp, size_t *sizep, int *recattrs, int *category, + recordid_t * recuid) +{ + int result; + pi_file_entry_t *entp; + + if (pf->for_writing || pf->resource_flag) + return PI_ERR_FILE_INVALID; + + if (recindex < 0 || recindex >= pf->num_entries) + return PI_ERR_GENERIC_ARGUMENT; + + entp = &pf->entries[recindex]; + + if (bufp) { + if ((result = pi_file_set_rbuf_size(pf, (size_t) entp->size)) < 0) { + LOG((PI_DBG_API, PI_DBG_LVL_ERR, + "FILE READ_RECORD Unable to set buffer size!\n")); + return result; + } + + fseek(pf->f, pf->entries[recindex].offset, SEEK_SET); + + if (fread(pf->rbuf, 1, (size_t) entp->size, pf->f) != + (size_t) entp->size) { + LOG((PI_DBG_API, PI_DBG_LVL_ERR, + "FILE READ_RECORD Unable to read record!\n")); + return PI_ERR_FILE_ERROR; + } + + *bufp = pf->rbuf; + } + + LOG ((PI_DBG_API, PI_DBG_LVL_INFO, + "FILE READ_RECORD Record: %d Bytes: %d\n", recindex, entp->size)); + + if (sizep) + *sizep = entp->size; + if (recattrs) + *recattrs = entp->attrs & 0xf0; + if (category) + *category = entp->attrs & 0xf; + if (recuid) + *recuid = entp->uid; + + return 0; +} + +int +pi_file_read_record_by_id(pi_file_t *pf, recordid_t uid, + void **bufp, size_t *sizep, int *idxp, int *attrp, + int *catp) +{ + int i; + struct pi_file_entry *entp; + + for (i = 0, entp = pf->entries; i < pf->num_entries; + i++, entp++) { + if (entp->uid == uid) { + if (idxp) + *idxp = i; + return (pi_file_read_record + (pf, i, bufp, sizep, attrp, catp, &uid)); + } + } + + return PI_ERR_FILE_NOT_FOUND; +} + +int +pi_file_id_used(const pi_file_t *pf, recordid_t uid) +{ + int i; + struct pi_file_entry *entp; + + for (i = 0, entp = pf->entries; i < pf->num_entries; i++, entp++) { + if (entp->uid == uid) + return 1; + } + return 0; +} + +pi_file_t * +pi_file_create(const char *name, const struct DBInfo *info) +{ + pi_file_t *pf = calloc(1, sizeof(pi_file_t)); + + if (pf == NULL) + return NULL; + + if ((pf->file_name = strdup(name)) == NULL) + goto bad; + + pf->for_writing = 1; + pf->info = *info; + + if (info->flags & dlpDBFlagResource) { + pf->resource_flag = 1; + pf->ent_hdr_size = PI_RESOURCE_ENT_SIZE; + } else { + pf->resource_flag = 0; + pf->ent_hdr_size = PI_RECORD_ENT_SIZE; + } + + pf->tmpbuf = pi_buffer_new(2048); + if (pf->tmpbuf == NULL) + goto bad; + + return (pf); + +bad: + pi_file_free(pf); + return NULL; +} + +int +pi_file_set_info(pi_file_t *pf, const struct DBInfo *ip) +{ + if (!pf->for_writing) + return PI_ERR_FILE_INVALID; + + if ((ip->flags & dlpDBFlagResource) != + (pf->info.flags & dlpDBFlagResource)) + return PI_ERR_FILE_INVALID; + + pf->info = *ip; + + return 0; +} + +int +pi_file_set_app_info(pi_file_t *pf, void *data, size_t size) +{ + void *p; + + if (!size) { + if (pf->app_info) + free(pf->app_info); + pf->app_info_size = 0; + return 0; + } + + if ((p = malloc(size)) == NULL) + return PI_ERR_GENERIC_MEMORY; + + memcpy(p, data, size); + + if (pf->app_info) + free(pf->app_info); + + pf->app_info = p; + pf->app_info_size = size; + + return 0; +} + +int +pi_file_set_sort_info(pi_file_t *pf, void *data, size_t size) +{ + void *p; + + if (!size) { + if (pf->sort_info) + free(pf->sort_info); + pf->sort_info_size = 0; + return 0; + } + + if ((p = malloc(size)) == NULL) + return PI_ERR_GENERIC_MEMORY; + + memcpy(p, data, size); + + if (pf->sort_info) + free(pf->sort_info); + + pf->sort_info = p; + pf->sort_info_size = size; + + return 0; +} + +int +pi_file_append_resource(pi_file_t *pf, void *data, size_t size, + unsigned long restype, int resid) +{ + pi_file_entry_t *entp; + + if (!pf->for_writing || !pf->resource_flag) + return PI_ERR_FILE_INVALID; + if (pi_file_type_id_used(pf, restype, resid)) + return PI_ERR_FILE_ALREADY_EXISTS; + + entp = pi_file_append_entry(pf); + if (entp == NULL) + return PI_ERR_GENERIC_MEMORY; + + if (size && pi_buffer_append(pf->tmpbuf, data, size) == NULL) { + pf->err = 1; + return PI_ERR_GENERIC_MEMORY; + } + + entp->size = size; + entp->type = restype; + entp->resource_id = resid; + + return size; +} + +int +pi_file_append_record(pi_file_t *pf, void *data, size_t size, + int recattrs, int category, recordid_t recuid) +{ + pi_file_entry_t *entp; + + if (!pf->for_writing || pf->resource_flag) + return PI_ERR_FILE_INVALID; + if (recuid && pi_file_id_used(pf, recuid)) + return PI_ERR_FILE_ALREADY_EXISTS; + + entp = pi_file_append_entry(pf); + if (entp == NULL) + return PI_ERR_GENERIC_MEMORY; + + if (size && pi_buffer_append(pf->tmpbuf, data, size) == NULL) { + pf->err = 1; + return PI_ERR_GENERIC_MEMORY; + } + + entp->size = size; + entp->attrs = (recattrs & 0xf0) | (category & 0xf); + entp->uid = recuid; + + return size; +} + +void +pi_file_get_entries(pi_file_t *pf, int *entries) +{ + *entries = pf->num_entries; +} + +#if XXX +int +pi_file_retrieve(pi_file_t *pf, int socket, int cardno, + progress_func report_progress) +{ + int db = -1, + result, + old_device = 0; + + unsigned int j; + + struct DBInfo dbi; + struct DBSizeInfo size_info; + + pi_buffer_t *buffer = NULL; + pi_progress_t progress; + + pi_reset_errors(socket); + memset(&size_info, 0, sizeof(size_info)); + memset(&dbi, 0, sizeof(dbi)); + + /* Try to get more info on the database to retrieve. Note that + * with some devices like the Tungsten T3 and shadowed databases + * like AddressDB, the size_info is -wrong-. It doesn't reflect + * the actual contents of the database except for the number of + * records. Also, this call doesn't work pre-OS 3. + */ + if ((result = dlp_FindDBByName(socket, cardno, pf->info.name, + NULL, NULL, &dbi, &size_info)) < 0) + { + if (result != PI_ERR_DLP_UNSUPPORTED) + goto fail; + old_device = 1; + } + + if ((result = dlp_OpenDB (socket, cardno, dlpOpenRead | dlpOpenSecret, + pf->info.name, &db)) < 0) + goto fail; + + buffer = pi_buffer_new (DLP_BUF_SIZE); + if (buffer == NULL) { + result = pi_set_error(socket, PI_ERR_GENERIC_MEMORY); + goto fail; + } + + if (old_device) { + int num_records; + if ((result = dlp_ReadOpenDBInfo(socket, db, &num_records)) < 0) + goto fail; + size_info.numRecords = num_records; + } + + memset(&progress, 0, sizeof(progress)); + progress.type = PI_PROGRESS_RECEIVE_DB; + progress.data.db.pf = pf; + progress.data.db.size = size_info; + + if (size_info.appBlockSize + || (dbi.miscFlags & dlpDBMiscFlagRamBased) + || old_device) { + /* what we're trying to do here is avoid trying to read an appBlock + * from a ROM file, because this crashes on several devices. + * Also, on several palmOne devices, the size info returned by the OS + * is absolutely incorrect. This happens with some system shadow files + * like AddressDB on T3, which actually do contain data and an appInfo + * block but the system tells us there's no appInfo and nearly no data, + * but still gives the accurate number of records. Seems to be bad + * structure shadows in PACE. + * In any case, the ultimate result is that: + * 1. On devices pre-OS 3, we do always try to read the appInfo block + * because dlp_FindDBByName() is unsupported so we can't find out if + * there's an appInfo block + * 2. On OS5+ devices, we're not sure that the appInfo size we have is + * accurate. But if we try reading an appInfo block in ROM it may + * crash the device + * 3. Therefore, we only try to read the appInfo block if we are + * working on a RAM file or we are sure that a ROM file has appInfo. + */ + result = dlp_ReadAppBlock(socket, db, 0, DLP_BUF_SIZE, buffer); + if (result > 0) { + pi_file_set_app_info(pf, buffer->data, (size_t)result); + progress.transferred_bytes += result; + if (report_progress && report_progress(socket, + &progress) == PI_TRANSFER_STOP) { + result = PI_ERR_FILE_ABORTED; + goto fail; + } + } + } + + if (pf->info.flags & dlpDBFlagResource) { + for (j = 0; j < size_info.numRecords; j++) { + int resource_id; + unsigned long type; + + if ((result = dlp_ReadResourceByIndex(socket, db, j, buffer, + &type, &resource_id)) < 0) + goto fail; + + if ((result = pi_file_append_resource (pf, buffer->data, buffer->used, + type, resource_id)) < 0) { + pi_set_error(socket, result); + goto fail; + } + + progress.transferred_bytes += buffer->used; + progress.data.db.transferred_records++; + + if (report_progress && report_progress(socket, + &progress) == PI_TRANSFER_STOP) { + result = pi_set_error(socket, PI_ERR_FILE_ABORTED); + goto fail; + } + } + } else for (j = 0; j < size_info.numRecords; j++) { + int attr, + category; + unsigned long resource_id; + + if ((result = dlp_ReadRecordByIndex(socket, db, j, buffer, &resource_id, &attr, + &category)) < 0) + goto fail; + + progress.transferred_bytes += buffer->used; + progress.data.db.transferred_records++; + + if (report_progress + && report_progress(socket, + &progress) == PI_TRANSFER_STOP) { + result = pi_set_error(socket, PI_ERR_FILE_ABORTED); + goto fail; + } + + /* There is no way to restore records with these + attributes, so there is no use in backing them up + */ + if (attr & + (dlpRecAttrArchived | dlpRecAttrDeleted)) + continue; + if ((result = pi_file_append_record(pf, buffer->data, buffer->used, + attr, category, resource_id)) < 0) { + pi_set_error(socket, result); + goto fail; + } + } + + pi_buffer_free(buffer); + + return dlp_CloseDB(socket, db); + +fail: + if (db != -1 && pi_socket_connected(socket)) { + int err = pi_error(socket); /* make sure we keep last error code */ + int palmoserr = pi_palmos_error(socket); + + dlp_CloseDB(socket, db); + + pi_set_error(socket, err); /* then restore it afterwards */ + pi_set_palmos_error(socket, palmoserr); + } + + if (buffer != NULL) + pi_buffer_free (buffer); + + if (result >= 0) { + /* one of our pi_file* calls failed */ + result = pi_set_error(socket, PI_ERR_FILE_ERROR); + } + return result; +} + +int +pi_file_install(pi_file_t *pf, int socket, int cardno, + progress_func report_progress) +{ + int db = -1, + j, + reset = 0, + flags, + version, + freeai = 0, + result, + err1, + err2; + size_t l, + size = 0; + void *buffer; + pi_progress_t progress; + + version = pi_version(socket); + + memset(&progress, 0, sizeof(progress)); + progress.type = PI_PROGRESS_SEND_DB; + progress.data.db.pf = pf; + progress.data.db.size.numRecords = pf->num_entries; + progress.data.db.size.dataBytes = pf->app_info_size; + progress.data.db.size.appBlockSize = pf->app_info_size; + progress.data.db.size.maxRecSize = pi_maxrecsize(socket); + + /* compute total size for progress reporting, and check that + either records are 64k or less, or the handheld can accept + large records. we do this prior to starting the install, + to avoid messing the device up if we have to fail. */ + for (j = 0; j < pf->num_entries; j++) { + result = (pf->info.flags & dlpDBFlagResource) ? + pi_file_read_resource(pf, j, 0, &size, 0, 0) : + pi_file_read_record(pf, j, 0, &size, 0, 0, 0); + if (result < 0) { + LOG((PI_DBG_API, PI_DBG_LVL_ERR, + "FILE INSTALL can't read all records/resources\n")); + goto fail; + } + if (size > 65536 && version < 0x0104) { + LOG((PI_DBG_API, PI_DBG_LVL_ERR, + "FILE INSTALL Database contains" + " record/resource over 64K!\n")); + goto fail; + } + progress.data.db.size.dataBytes += size; + } + + progress.data.db.size.totalBytes = + progress.data.db.size.dataBytes + + pf->ent_hdr_size * pf->num_entries + + PI_HDR_SIZE + 2; + + /* Delete DB if it already exists */ + dlp_DeleteDB(socket, cardno, pf->info.name); + + /* Set up DB flags */ + flags = pf->info.flags; + + /* Judd - 25Nov99 - Graffiti hack We want to make sure that these 2 + flags get set for this one */ + if (pf->info.creator == pi_mktag('g', 'r', 'a', 'f')) { + flags |= dlpDBFlagNewer; + flags |= dlpDBFlagReset; + } + + if (strcmp(pf->info.name, "Graffiti ShortCuts ") == 0) { + flags |= 0x8000; /* Rewrite an open DB */ + reset = 1; /* To be on the safe side */ + } + LOG((PI_DBG_API, PI_DBG_LVL_INFO, + "FILE INSTALL Name: %s Flags: %8.8X\n", pf->info.name, flags)); + + /* Create DB */ + if ((result = dlp_CreateDB + (socket, pf->info.creator, pf->info.type, cardno, flags, + pf->info.version, pf->info.name, &db)) < 0) { + int retry = 0; + + /* Judd - 25Nov99 - Graffiti hack + + The dlpDBFlagNewer specifies that if a DB is open and + cannot be deleted then it can be overwritten by a DB with + a different name. The creator ID of "graf" is what + really identifies a DB, not the name. We could call it + JimBob and the palm would still find it and use it. */ + + if (strcmp(pf->info.name, "Graffiti ShortCuts ") == 0) { + strcpy(pf->info.name, "Graffiti ShortCuts"); + retry = 1; + } else if (strcmp(pf->info.name, "Graffiti ShortCuts") == + 0) { + strcpy(pf->info.name, "Graffiti ShortCuts "); + retry = 1; + } else if (pf->info.creator == + pi_mktag('g', 'r', 'a', 'f')) { + /* Yep, someone has named it JimBob */ + strcpy(pf->info.name, "Graffiti ShortCuts"); + retry = 1; + } + + if (retry) { + /* Judd - 25Nov99 - Graffiti hack + We changed the name, now we can try to write it + again */ + if ((result = dlp_CreateDB + (socket, pf->info.creator, pf->info.type, + cardno, flags, pf->info.version, + pf->info.name, &db)) < 0) { + return result; + } + } else { + return result; + } + } + + pi_file_get_app_info(pf, &buffer, &l); + + /* Compensate for bug in OS 2.x Memo */ + if (version > 0x0100 + && strcmp(pf->info.name, "MemoDB") == 0 + && l > 0 + && l < 282) { + /* Justification: The appInfo structure was accidentally + lengthend in OS 2.0, but the Memo application does not + check that it is long enough, hence the shorter block + from OS 1.x will cause the 2.0 Memo application to lock + up if the sort preferences are modified. This code + detects the installation of a short app info block on a + 2.0 machine, and lengthens it. This transformation will + never lose information. */ + void *b2 = calloc(1, 282); + memcpy(b2, buffer, (size_t)l); + buffer = b2; + progress.data.db.size.appBlockSize = 282; + l = 282; + freeai = 1; + } + + /* All system updates seen to have the 'ptch' type, so trigger a + reboot on those */ + if (pf->info.creator == pi_mktag('p', 't', 'c', 'h')) + reset = 1; + + if (pf->info.flags & dlpDBFlagReset) + reset = 1; + + /* Upload appInfo block */ + if (l > 0) { + if ((result = dlp_WriteAppBlock(socket, db, buffer, l)) < 0) { + if (freeai) + free(buffer); + goto fail; + } + if (freeai) + free(buffer); + progress.transferred_bytes = l; + if (report_progress && report_progress(socket, + &progress) == PI_TRANSFER_STOP) { + result = pi_set_error(socket, PI_ERR_FILE_ABORTED); + goto fail; + } + } + + /* Upload resources / records */ + if (pf->info.flags & dlpDBFlagResource) { + for (j = 0; j < pf->num_entries; j++) { + int resource_id; + unsigned long type; + + if ((result = pi_file_read_resource(pf, j, &buffer, &size, + &type, &resource_id)) < 0) + goto fail; + + /* Skip empty resource, it cannot be installed */ + if (size == 0) + continue; + + if ((result = dlp_WriteResource(socket, db, type, resource_id, buffer, + size)) < 0) + goto fail; + + progress.transferred_bytes += size; + progress.data.db.transferred_records++; + + if (report_progress && report_progress(socket, + &progress) == PI_TRANSFER_STOP) { + result = pi_set_error(socket, PI_ERR_FILE_ABORTED); + goto fail; + } + + /* If we see a 'boot' section, regardless of file + type, require reset */ + if (type == pi_mktag('b', 'o', 'o', 't')) + reset = 1; + } + } else { + for (j = 0; j < pf->num_entries; j++) { + int attr, + category; + unsigned long resource_id; + + if ((result = pi_file_read_record(pf, j, &buffer, &size, &attr, + &category, &resource_id)) < 0) + goto fail; + + /* Old OS version cannot install deleted records, so + don't even try */ + if ((attr & (dlpRecAttrArchived | dlpRecAttrDeleted)) + && version < 0x0101) + continue; + + if ((result = dlp_WriteRecord(socket, db, attr, resource_id, category, + buffer, size, 0)) < 0) + goto fail; + + progress.transferred_bytes += size; + progress.data.db.transferred_records++; + + if (report_progress + && report_progress(socket, + &progress) == PI_TRANSFER_STOP) { + result = pi_set_error(socket, PI_ERR_FILE_ABORTED); + goto fail; + } + } + } + + if (reset) + dlp_ResetSystem(socket); + + return dlp_CloseDB(socket, db); + +fail: + /* save error codes then restore them after + closing/deleting the DB */ + err1 = pi_error(socket); + err2 = pi_palmos_error(socket); + + LOG((PI_DBG_API, PI_DBG_LVL_ERR, "FILE INSTALL error: pilot-link " + "0x%04x, PalmOS 0x%04x\n", err1, err2)); + if (db != -1 && pi_socket_connected(socket)) + dlp_CloseDB(socket, db); + if (pi_socket_connected(socket)) + dlp_DeleteDB(socket, cardno, pf->info.name); + + pi_set_error(socket, err1); + pi_set_palmos_error(socket, err2); + + if (result >= 0) + result = pi_set_error(socket, PI_ERR_FILE_ERROR); + return result; +} + +int +pi_file_merge(pi_file_t *pf, int socket, int cardno, + progress_func report_progress) +{ + int db = -1, + j, + reset = 0, + version, + result; + void *buffer; + size_t size; + pi_progress_t progress; + + version = pi_version(socket); + + memset(&progress, 0, sizeof(progress)); + progress.type = PI_PROGRESS_SEND_DB; + progress.data.db.pf = pf; + progress.data.db.size.numRecords = pf->num_entries; + progress.data.db.size.dataBytes = pf->app_info_size; + progress.data.db.size.appBlockSize = pf->app_info_size; + progress.data.db.size.maxRecSize = pi_maxrecsize(socket); + + if (dlp_OpenDB(socket, cardno, dlpOpenReadWrite | dlpOpenSecret, + pf->info.name, &db) < 0) + return pi_file_install(pf, socket, cardno, report_progress); + + /* compute total size for progress reporting, and check that + either records are 64k or less, or the handheld can accept + large records. we do this prior to starting the install, + to avoid messing the device up if we have to fail. */ + for (j = 0; j < pf->num_entries; j++) { + result = (pf->info.flags & dlpDBFlagResource) ? + pi_file_read_resource(pf, j, 0, &size, 0, 0) : + pi_file_read_record(pf, j, 0, &size, 0, 0, 0); + if (result < 0) { + LOG((PI_DBG_API, PI_DBG_LVL_ERR, + "FILE INSTALL can't read all records/resources\n")); + goto fail; + } + if (size > 65536 && version < 0x0104) { + LOG((PI_DBG_API, PI_DBG_LVL_ERR, + "FILE INSTALL Database contains" + " record/resource over 64K!\n")); + result = pi_set_error(socket, PI_ERR_DLP_DATASIZE); + goto fail; + } + progress.data.db.size.dataBytes += size; + } + + progress.data.db.size.totalBytes = + progress.data.db.size.dataBytes + + pf->ent_hdr_size * pf->num_entries + + PI_HDR_SIZE + 2; + + /* All system updates seen to have the 'ptch' type, so trigger a + reboot on those */ + if (pf->info.creator == pi_mktag('p', 't', 'c', 'h')) + reset = 1; + + if (pf->info.flags & dlpDBFlagReset) + reset = 1; + + /* Upload resources / records */ + if (pf->info.flags & dlpDBFlagResource) { + for (j = 0; j < pf->num_entries; j++) { + int resource_id; + unsigned long type; + + if ((result = pi_file_read_resource + (pf, j, &buffer, &size, &type, &resource_id)) < 0) + goto fail; + + if (size == 0) + continue; + + if ((result = dlp_WriteResource + (socket, db, type, resource_id, buffer, size)) < 0) + goto fail; + + progress.transferred_bytes += size; + progress.data.db.transferred_records++; + + if (report_progress && report_progress(socket, + &progress) == PI_TRANSFER_STOP) { + result = pi_set_error(socket, PI_ERR_FILE_ABORTED); + goto fail; + } + + /* If we see a 'boot' section, regardless of file + type, require reset */ + if (type == pi_mktag('b', 'o', 'o', 't')) + reset = 1; + } + } else { + for (j = 0; j < pf->num_entries; j++) { + int attr, + category; + unsigned long resource_id; + + if ((result = pi_file_read_record(pf, j, &buffer, &size, + &attr, &category, &resource_id)) < 0) + goto fail; + + /* Old OS version cannot install deleted records, so + don't even try */ + if ((attr & (dlpRecAttrArchived | dlpRecAttrDeleted)) + && version < 0x0101) + continue; + + if ((result = dlp_WriteRecord(socket, db, attr, 0, category, + buffer, size, 0)) < 0) + goto fail; + + progress.transferred_bytes += size; + progress.data.db.transferred_records++; + + if (report_progress && report_progress(socket, + &progress) == PI_TRANSFER_STOP) { + result = PI_ERR_FILE_ABORTED; + goto fail; + } + } + } + + if (reset) + dlp_ResetSystem(socket); + + return dlp_CloseDB(socket, db); + +fail: + if (db != -1 && pi_socket_connected(socket)) { + int err1 = pi_error(socket); + int err2 = pi_palmos_error(socket); + + dlp_CloseDB(socket, db); + + pi_set_error(socket, err1); + pi_set_palmos_error(socket, err2); + } + if (result >= 0) + result = pi_set_error(socket, PI_ERR_FILE_ERROR); + return result; +} +#endif + +/*********************************************************************************/ +/* */ +/* INTERNAL FUNCTIONS */ +/* */ +/*********************************************************************************/ + +/*********************************************************************** + * + * Function: pi_file_close_for_write + * + * Summary: Writes a file to disk + * + * Parameters: None + * + * Returns: Nothing + * + ***********************************************************************/ +static int +pi_file_close_for_write(pi_file_t *pf) +{ + int i, + offset; + FILE *f; + + struct DBInfo *ip; + struct pi_file_entry *entp; + struct stat sbuf; + + unsigned char buf[512]; + unsigned char *p; + + ip = &pf->info; + if (pf->num_entries >= 64 * 1024) { + LOG((PI_DBG_API, PI_DBG_LVL_ERR, + "pi_file_close_for_write: too many entries " + "for this implentation of pi-file: %d\n", + pf->num_entries)); + return PI_ERR_FILE_INVALID; + } + + /* + * Unlink instead of overwriting. + * For the case of something along the lines of: + * cp -lav backup_2005_05_27 backup_2005_05_28 + * Then updating the new copy. + * -- Warp. + */ + + if (!stat (pf->file_name, &sbuf)) + if (S_ISREG(sbuf.st_mode)) + unlink (pf->file_name); + + if ((f = fopen(pf->file_name, "wb")) == NULL) + return PI_ERR_FILE_ERROR; + + ip = &pf->info; + + offset = PI_HDR_SIZE + pf->num_entries * pf->ent_hdr_size + 2; + + p = buf; + memcpy(p, ip->name, 32); + set_short(p + 32, ip->flags); + set_short(p + 34, ip->version); + set_long(p + 36, unix_time_to_pilot_time(ip->createDate)); + set_long(p + 40, unix_time_to_pilot_time(ip->modifyDate)); + set_long(p + 44, unix_time_to_pilot_time(ip->backupDate)); + set_long(p + 48, ip->modnum); + set_long(p + 52, pf->app_info_size ? offset : 0); + offset += pf->app_info_size; + set_long(p + 56, pf->sort_info_size ? offset : 0); + offset += pf->sort_info_size; + set_long(p + 60, ip->type); + set_long(p + 64, ip->creator); + set_long(p + 68, pf->unique_id_seed); + set_long(p + 72, pf->next_record_list_id); + set_short(p + 76, pf->num_entries); + + if (fwrite(buf, PI_HDR_SIZE, 1, f) != 1) + goto bad; + + for (i = 0, entp = pf->entries; i < pf->num_entries; i++, entp++) { + entp->offset = offset; + + p = buf; + if (pf->resource_flag) { + set_long(p, entp->type); + set_short(p + 4, entp->resource_id); + set_long(p + 6, entp->offset); + } else { + set_long(p, entp->offset); + set_byte(p + 4, entp->attrs); + set_treble(p + 5, entp->uid); + } + + if (fwrite(buf, (size_t) pf->ent_hdr_size, 1, f) != 1) + goto bad; + + offset += entp->size; + } + + /* This may just be packing */ + fwrite("\0\0", 1, 2, f); + + if (pf->app_info + && (fwrite(pf->app_info, 1,(size_t) pf->app_info_size, f) != + (size_t) pf->app_info_size)) + goto bad; + + if (pf->sort_info + && (fwrite(pf->sort_info, 1, (size_t) pf->sort_info_size, f) != + (size_t) pf->sort_info_size)) + goto bad; + + + fwrite(pf->tmpbuf->data, pf->tmpbuf->used, 1, f); + fflush(f); + + if (ferror(f) || feof(f)) + goto bad; + + fclose(f); + return 0; + +bad: + fclose(f); + return PI_ERR_FILE_ERROR; +} + +/*********************************************************************** + * + * Function: pi_file_free + * + * Summary: Flush and clean the file handles used + * + * Parameters: file handle pi_file_t* + * + * Returns: void + * + ***********************************************************************/ +static +void pi_file_free(pi_file_t *pf) +{ + ASSERT (pf != NULL); + + if (pf->f != 0) + fclose(pf->f); + + if (pf->app_info != NULL) + free(pf->app_info); + + if (pf->sort_info != NULL) + free(pf->sort_info); + + if (pf->entries != NULL) + free(pf->entries); + + if (pf->file_name != NULL) + free(pf->file_name); + + if (pf->rbuf != NULL) + free(pf->rbuf); + + if (pf->tmpbuf != NULL) + pi_buffer_free(pf->tmpbuf); + + /* in case caller forgets the struct has been freed... */ + memset(pf, 0, sizeof(pi_file_t)); + + free(pf); +} + +/*********************************************************************** + * + * Function: pi_file_set_rbuf_size + * + * Summary: set pi_file rbuf size + * + * Parameters: file handle pi_file_t*, rbuf size + * + * Returns: 0 for success, negative otherwise + * + ***********************************************************************/ +static int +pi_file_set_rbuf_size(pi_file_t *pf, size_t size) +{ + size_t new_size; + void *rbuf; + + if (size > (size_t)pf->rbuf_size) { + if (pf->rbuf_size == 0) { + new_size = size + 2048; + rbuf = malloc(new_size); + } else { + new_size = size + 2048; + rbuf = realloc(pf->rbuf, new_size); + } + + if (rbuf == NULL) + return PI_ERR_GENERIC_MEMORY; + + pf->rbuf_size = new_size; + pf->rbuf = rbuf; + } + + return 0; +} + +/*********************************************************************** + * + * Function: pi_file_append_entry + * + * Summary: Internal function to extend entry list if necessary, + * and return a pointer to the next available slot + * + * Parameters: None + * + * Returns: NULL on allocation error + * + ***********************************************************************/ +static pi_file_entry_t +*pi_file_append_entry(pi_file_t *pf) +{ + int new_count; + size_t new_size; + struct pi_file_entry *new_entries; + struct pi_file_entry *entp; + + if (pf->num_entries >= pf->num_entries_allocated) { + if (pf->num_entries_allocated == 0) + new_count = 100; + else + new_count = pf->num_entries_allocated * 3 / 2; + new_size = new_count * sizeof *pf->entries; + + if (pf->entries == NULL) + new_entries = malloc(new_size); + else + new_entries = realloc(pf->entries, new_size); + + if (new_entries == NULL) + return NULL; + + pf->num_entries_allocated = new_count; + pf->entries = new_entries; + } + + entp = &pf->entries[pf->num_entries++]; + memset(entp, 0, sizeof *entp); + return entp; +} + +static int +pi_file_find_resource_by_type_id(const pi_file_t *pf, + unsigned long restype, int resid, int *resindex) +{ + int i; + struct pi_file_entry *entp; + + if (!pf->resource_flag) + return PI_ERR_FILE_INVALID; + + for (i = 0, entp = pf->entries; i < pf->num_entries; i++, entp++) { + if (entp->type == restype && entp->resource_id == resid) { + if (resindex) + *resindex = i; + return 1; + } + } + return 0; +} + + +/* vi: set ts=8 sw=4 sts=4 noexpandtab: cin */ +/* ex: set tabstop=4 expandtab: */ +/* Local Variables: */ +/* indent-tabs-mode: t */ +/* c-basic-offset: 8 */ +/* End: */ + diff --git a/pilot-link/pi-file.h b/pilot-link/pi-file.h new file mode 100644 index 000000000..47f7b4105 --- /dev/null +++ b/pilot-link/pi-file.h @@ -0,0 +1,435 @@ +/* + * $Id: pi-file.h,v 1.1 2007/07/21 03:54:52 robertl Exp $ + * + * pi-file.h: Pilot File Interface Library + * + * This is free software, licensed under the GNU Library Public License V2. + * See the file COPYING.LIB for details. + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library + * General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** @file pi-file.h + * @brief Database file install, retrieve and management interface + * + * The pi-file layer is a convenience management library that provides for + * easy access, creation, install and retrieve of database files (PRC, PDB, + * PQA) + * + * Palm databases on the local machines can be created with pi_file_create() + * or opened read-only using pi_file_open(). Several functions are provided + * to access resources and records. Caller must make sure to use the + * appropriate functions, depending on the type of the database (i.e. only + * use the record read/write functions on data databases, only use the + * resource read/write functions on resource databases). + * + * A set of utility functions are provided to facilitate installing and + * retrieving databases on the devide. pi_file_install() will perform all + * the steps required to install a database on a device. pi_file_merge() can + * be used to update an existing database or add new records/resources to + * it. pi_file_retrieve() will read a database from the device. + */ + +#ifndef _PILOT_FILE_H_ +#define _PILOT_FILE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pi-dlp.h" /* For DBInfo */ + +/** @brief Structure describing a record or resource entry in a database file */ +typedef struct pi_file_entry { + int offset; /**< Offset in the on-disk file */ + int size; /**< Size of the resource or record */ + int resource_id; /**< For resources, resource ID */ + int attrs; /**< Record attributes */ + unsigned long type; /**< For resdources, resource type */ + recordid_t uid; /**< For records, record unique ID */ +} pi_file_entry_t; + +typedef struct pi_file { + int err; + int for_writing; /**< Non-zero if the file was opened with pi_file_create() */ + int app_info_size; /**< Size of the appInfo block */ + int sort_info_size; /**< Size of the sortInfo block */ + int next_record_list_id; + int resource_flag; + int ent_hdr_size; /**< Size of the header for each resource/record (depends on whether the file is a resource or record file) */ + int num_entries; /**< Number of actual entries in the entries memory block */ + int num_entries_allocated; /**< Number of entries allocated in the entries memory block */ + int rbuf_size; /**< Size of the internal read buffer */ + FILE *f; /**< Actual on-disk file */ + pi_buffer_t *tmpbuf; /**< Temporary buffer for databases opened with pi_file_create() */ + char *file_name; /**< Access path */ + void *app_info; /**< Pointer to the appInfo block or NULL */ + void *sort_info; /**< Pointer to the sortInfo block or NULL */ + void *rbuf; /**< Read buffer, used internally */ + unsigned long unique_id_seed; /**< Database file's unique ID seed as read from an existing file */ + struct DBInfo info; /**< Database information and attributes */ + struct pi_file_entry *entries; /**< Array of records / resources */ +} pi_file_t; + +/** @brief Transfer progress callback structure + * + * The progress callback structure is prepared by the client application and + * passed to pi_file_install(), pi_file_merge() and pi_file_retrieve() + * functions. It allows the client application to be notified during a file + * transfer (i.e. to update a progress indicator) and gives it a chance to + * cancel transfers. + */ +typedef struct { + int type; /**< Transfer type (see #piProgressType enum) */ + int transferred_bytes; /**< Current transferred bytes */ + void *userinfo; /**< Provided by and passed back to client (not used for now, will be in a future release) */ + union { + struct { + pi_file_t *pf; /**< May be NULL */ + struct DBSizeInfo size; /**< Size information */ + int transferred_records;/**< Number of records or resources */ + } db; + + struct { + char *path; /**< VFS file path */ + long total_bytes; /**< File size in bytes */ + } vfs; + } data; +} pi_progress_t; + +/** @brief Progress callback function definition + * + * Callback should return either #PI_TRANSFER_STOP or + * #PI_TRANSFER_CONTINUE + */ +typedef int (*progress_func)(int socket, pi_progress_t *progress); + +/** @brief Transfer progress types for the @a type member of pi_progress_t */ +enum piProgressType { + PI_PROGRESS_SEND_DB = 1, /**< Sending a database */ + PI_PROGRESS_RECEIVE_DB, /**< Receiving a database */ + PI_PROGRESS_SEND_VFS, /**< Sending a VFS file */ + PI_PROGRESS_RECEIVE_VFS /**< Receiving a VFS file */ +}; + + +#define PI_TRANSFER_STOP 0 /**< Returned by progress callback to stop the transfer */ +#define PI_TRANSFER_CONTINUE 1 /**< Returned by progress callback to continue the transfer */ + +/** @name Opening and closing files */ +/*@{*/ + /** @brief Open a database for read-only access + * + * Don't dispose of the returned structure directly. + * Use pi_file_close() instead. + * + * @param name The access path to the database to open on the local machine + * @return An initialized pi_file_t structure or NULL. + */ + extern pi_file_t *pi_file_open + PI_ARGS((const char *name)); + + /** @brief Create a new database file + * + * A new database file is created on the local machine. + * + * @param name Access path of the new file to create + * @param INPUT Characteristics of the database to create + * @return A new pi_file_t structure. Use pi_file_close() to write data and close file. + */ + extern pi_file_t *pi_file_create + PI_ARGS((const char *name, const struct DBInfo *INPUT)); + + /** @brief Closes a local file + * + * If the file had been opened with pi_file_create, all + * modifications are written to disk before the file is closed + * + * @param pf The pi_file_t structure is being disposed of by this function + * @return An error code (see file pi-error.h) + */ + extern int pi_file_close PI_ARGS((pi_file_t *pf)); +/*@}*/ + +/** @name Reading from open files */ +/*@{*/ + /** @brief Returns database specification + * + * @param pf An open file + * @return DBInfo structure describing the file + */ + extern void pi_file_get_info + PI_ARGS((const pi_file_t *pf, struct DBInfo *OUTPUT)); + + /** @brief Returns the file's appInfo block + * + * The returned data is not a copy of the pi_file_t's appInfo + * structures. Don't dispose or modify it. + * + * @param pf An open file + * @param datap On return, ptr to appInfo data or NULL + * @param sizep On return, size of the appInfoBlock + */ + extern void pi_file_get_app_info + PI_ARGS((pi_file_t *pf, void **datap, size_t *sizep)); + + /** @brief Returns the file's sortInfo block + * + * The returned data is not a copy of the pi_file_t's sortInfo + * block: do not dispose of it! + * + * @param pf An open file + * @param datap On return, ptr to sortInfo data or NULL + * @param sizep On return, size of the sortInfoBlock + */ + extern void pi_file_get_sort_info + PI_ARGS((pi_file_t *pf, void **dadtap, size_t *sizep)); + + /** @brief Read a resource by index + * + * If it exists, the returned data points directly into the file + * structures. Don't dispose or modify it. + * + * @param pf An open file + * @param resindex The resource index + * @param bufp On return, pointer to the resource data block + * @param sizep If not NULL, size of the resource data + * @param restype If not NULL, resource type + * @param resid If not NULL, resource + * @return Negative error code on error + */ + extern int pi_file_read_resource + PI_ARGS((pi_file_t *pf, int resindex, void **bufp, size_t *sizep, + unsigned long *restype, int *resid)); + + /** @brief Read a resource by type and ID + * + * If it exists, the returned data points directly into the file + * structures. + * + * @param pf An open file + * @param restype Resource type + * @param resid Resource ID + * @param bufp On return, pointer to the resource data or NULL + * @param sizep If not NULL, the size of the resource data + * @param resindex If not NULL, on return contains the resource index + * @return Negative error code on error + */ + extern int pi_file_read_resource_by_type_id + PI_ARGS((pi_file_t *pf, unsigned long restype, int resid, + void **bufp, size_t *sizep, int *resindex)); + + /** @brief Checks whether a resource type/id exists in an open file + * + * @param pf An open file + * @param restype Resource type to check + * @param resid Resource ID to check + * @return Non-zero if a resource with same type and id exists + */ + extern int pi_file_type_id_used + PI_ARGS((const pi_file_t *pf, unsigned long restype, int resid)); + + /** @brief Checks whether a record with the given UID exists + * + * @param pf An open file + * @param uid The record UID to look for + * @return Non-zero if a record with the same UID exists + */ + extern int pi_file_id_used + PI_ARGS((const pi_file_t *pf, recordid_t uid)); + + /** @brief Read a record by index + * + * If it exists, the returned data points directly into the file + * structures. Don't dispose or modify it. + * + * @param pf An open file + * @param recindex Record index + * @param bufp On return, pointer to the resource data or NULL + * @param sizep If not NULL, the size of the resource data + * @param recattrs If not NULL, the record attributes + * @param category If not NULL, the record category + * @param recuid If not NULL, the record unique ID + * @return Negative error code on error + */ + extern int pi_file_read_record + PI_ARGS((pi_file_t *pf, int recindex, void **bufp, size_t *sizep, + int *recattrs, int *category, recordid_t *recuid)); + + /** @brief Read a record by unique ID + * + * If it exists, the returned data points directly into the file + * structures. Don't dispose or modify it. + * + * @param pf An open file + * @param recuid The record unique ID + * @param bufp On return, pointer to the resource data or NULL + * @param sizep If not NULL, the size of the resource data + * @param recindex If not NULL, the record index + * @param recattrs If not NULL, the record attributes + * @param category If not NULL, the record category + * @return Negative error code on error + */ + extern int pi_file_read_record_by_id + PI_ARGS((pi_file_t *pf, recordid_t recuid, void **bufp, + size_t *sizep, int *recindex, int *recattrs, int *category)); + +#ifndef SWIG + extern void pi_file_get_entries + PI_ARGS((pi_file_t *pf, int *entries)); +#endif +/*@}*/ + +/** @name Modifying files open for write */ +/*@{*/ + /* may call these any time before close (even multiple times) */ + extern int pi_file_set_info + PI_ARGS((pi_file_t *pf, const struct DBInfo *infop)); + + /** @brief Set the database's appInfo block + * + * The file takes ownership of the passed data block + * + * @param pf A file open for write + * @param data Pointer to the data or NULL to clear the appInfo block + * @param size Size of the new data block + * @return Negative code on error + */ + extern int pi_file_set_app_info + PI_ARGS((pi_file_t *pf, void *data, size_t size)); + + /** @brief Set the database's sortInfo block + * + * The file takes ownership of the passed data block + * + * @param pf A file open for write + * @param data Pointer to the data or NULL to clear the sortInfo block + * @param size Size of the new data block + * @return Negative code on error + */ + extern int pi_file_set_sort_info + PI_ARGS((pi_file_t *pf, void *data, size_t size)); + + /** @brief Add a resource to a file open for write + * + * The file takes ownership of the passed data block + * Function will return PI_ERR_FILE_ALREADY_EXISTS if resource with + * same type/id already exists + * + * @param pf A file open for write + * @param data The resource data + * @param size The resource size + * @param restype Resource type + * @param resid Resource ID + * @return Negative code on error. + */ + extern int pi_file_append_resource + PI_ARGS((pi_file_t *pf, void *data, size_t size, + unsigned long restype, int resid)); + + /** @brief Add a record to a file open for write + * + * The file takes ownership of the passed data block Function will + * return PI_ERR_FILE_ALREADY_EXISTS if record with same unique ID + * already exists in the database + * + * @param pf A file open for write + * @param data The resource data + * @param size The resource size + * @param recattrs Record attributes + * @param category Record category + * @param recuid Record unique ID (pass 0 to have recuid automatically allocated) + * @return Negative code on error. + */ + extern int pi_file_append_record + PI_ARGS((pi_file_t *pf, void *buf, size_t size, int recattrs, + int category, recordid_t recuid)); +/*@}*/ + +/** @name File transfer utilities */ +/*@{*/ + /** @brief Retrieve a file from the handheld + * + * You must first create the local file using pi_file_create() + * + * @param pf A file open for write + * @param socket Socket to the connected handheld + * @param cardno Card number the file resides on (usually 0) + * @param report_progress Progress function callback or NULL (see #pi_progress_t structure) + * @return Negative code on error + */ + extern int pi_file_retrieve + PI_ARGS((pi_file_t *pf, int socket, int cardno, + progress_func report_progress)); + + /** @brief Install a new file on the handheld + * + * You must first open the local file with pi_file_open() + * + * @param pf An open file + * @param socket Socket to the connected handheld + * @param cardno Card number to install to (usually 0) + * @param report_progress Progress function callback or NULL (see #pi_progress_t structure) + * @return Negative code on error + */ + extern int pi_file_install + PI_ARGS((pi_file_t *pf, int socket, int cardno, + progress_func report_progress)); + + /** @brief Install a new file on the handheld or merge with an existing file + * + * The difference between this function and pi_file_install() is + * that if the file already exists on the handheld, pi_file_merge() + * will append data to the existing file. For resource files, all + * resources from the local file are sent to the handheld. If + * resources with the same type/ID exist in the handheld file, they + * are replaced with the new one. + * + * You must first open the local file with pi_file_open() + * + * @param pf An open file + * @param socket Socket to the connected handheld + * @param cardno Card number to install to (usually 0) + * @param report_progress Progress function callback or NULL (see #pi_progress_t structure) + * @return Negative code on error + */ + extern int pi_file_merge + PI_ARGS((pi_file_t *pf, int socket, int cardno, + progress_func report_progress)); +/*@}*/ + +/** @name Time utilities */ +/*@{*/ + /** @brief Convert Unix time to Palm OS time + * + * @param t Unix time value + * @return Time value with Palm OS timebase + */ + extern unsigned long unix_time_to_pilot_time + PI_ARGS((time_t t)); + + /** @brief Convert Palm OS time to Unix time + * + * @param raw_time Time value expressed in Palm OS timebase (seconds from 01-JAN-1904, 00:00) + * @return Unix time + */ + extern time_t pilot_time_to_unix_time + PI_ARGS((unsigned long raw_time)); +/*@}*/ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/pilot-link/pi-macros.h b/pilot-link/pi-macros.h new file mode 100644 index 000000000..ca1deb890 --- /dev/null +++ b/pilot-link/pi-macros.h @@ -0,0 +1,290 @@ +/* + * $Id: pi-macros.h,v 1.1 2007/07/21 03:54:52 robertl Exp $ + * + * pi-macros.h: pilot-link specific macro defintions + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library + * General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _PILOT_MACROS_H_ +#define _PILOT_MACROS_H_ + +#include +#include "pi-args.h" + +typedef unsigned long recordid_t; + +#ifdef __cplusplus +extern "C" { +#endif + + extern double get_float PI_ARGS((void *)); + extern void set_float PI_ARGS((void *, double)); + extern int compareTm PI_ARGS((struct tm * a, struct tm * b)); + +#ifdef __cplusplus +} +#endif +#ifndef __cplusplus +#define get_long(ptr) \ + (unsigned long) ( \ + (((unsigned long)((unsigned char *)(ptr))[0]) << 24) | \ + (((unsigned long)((unsigned char *)(ptr))[1]) << 16) | \ + (((unsigned long)((unsigned char *)(ptr))[2]) << 8) | \ + (((unsigned long)((unsigned char *)(ptr))[3]) ) ) + + +#define get_treble(ptr) ((unsigned long)\ + ((((unsigned char*)(ptr))[0] << 16) | \ + (((unsigned char*)(ptr))[1] << 8) | \ + (((unsigned char*)(ptr))[2]))) +#define get_short(ptr) ((unsigned short)\ + ((((unsigned char*)(ptr))[0] << 8) | \ + (((unsigned char*)(ptr))[1]))) +#define get_byte(ptr) (((unsigned char*)(ptr))[0]) +#define get_slong(ptr) (signed long)(\ + (get_long((ptr)) > 0x7FFFFFFF) ?\ + (((signed long)(get_long((ptr)) & 0x7FFFFFFF)) - 0x80000000):\ + ((signed long)(get_long((ptr))))\ + ) +#define get_streble(ptr) (signed long)(\ + (get_treble((ptr)) > 0x7FFFFF) ?\ + (((signed long)(get_treble((ptr)) & 0x7FFFFF)) - 0x800000):\ + ((signed long)(get_treble((ptr))))\ + ) +#define get_sshort(ptr) (signed short)(\ + (get_short((ptr)) > 0x7FFF) ?\ + (((signed short)(get_short((ptr)) & 0x7FFF)) - 0x8000):\ + ((signed short)(get_short((ptr))))\ + ) +#define get_sbyte(ptr) (signed char)(\ + (get_byte((ptr)) > 0x7F) ?\ + (((signed char)(get_byte((ptr)) & 0x7F)) - 0x80):\ + ((signed char)(get_byte((ptr))))\ + ) +#define set_long(ptr,val) ((((unsigned char*)(ptr))[0] = (unsigned char)(((unsigned long)(val)) >> 24) & 0xff), \ + (((unsigned char*)(ptr))[1] = (((unsigned long)(val)) >> 16) & 0xff), \ + (((unsigned char*)(ptr))[2] = (((unsigned long)(val)) >> 8) & 0xff), \ + (((unsigned char*)(ptr))[3] = (((unsigned long)(val)) >> 0) & 0xff)) +#define set_slong(ptr,val) set_long((ptr),((unsigned long)(\ + (((signed long)(val)) < 0) ?\ + ((unsigned long)(((signed long)(val)) + 0x80000000) | 0x80000000) :\ + (val)\ + ))) +#define set_treble(ptr,val) ((((unsigned char*)(ptr))[0] = (unsigned char)(((unsigned long)(val)) >> 16) & 0xff), \ + (((unsigned char*)(ptr))[1] = (((unsigned long)(val)) >> 8) & 0xff), \ + (((unsigned char*)(ptr))[2] = (((unsigned long)(val)) >> 0) & 0xff)) +#define set_streble(ptr,val) set_treble((ptr),((unsigned long)(\ + (((signed long)(val)) < 0) ?\ + ((unsigned long)(((signed long)(val)) + 0x800000) | 0x800000) :\ + (val)\ + ))) +#define set_short(ptr,val) ((((unsigned char*)(ptr))[0] = (((unsigned short)(val)) >> 8) & 0xff), \ + (((unsigned char*)(ptr))[1] = (((unsigned short)(val)) >> 0) & 0xff)) +#define set_sshort(ptr,val) set_short((ptr),((unsigned short)(\ + (((signed short)(val)) < 0) ?\ + ((unsigned short)(((signed short)(val)) + 0x8000) | 0x8000) :\ + (val)\ + ))) +#define set_byte(ptr,val) (((unsigned char*)(ptr))[0]=(val)) +#define set_sbyte(ptr,val) set_byte((ptr),((unsigned char)(\ + (((signed char)(val)) < 0) ?\ + ((unsigned char)(((signed char)(val)) + 0x80) | 0x80) :\ + (val)\ + ))) +#define char4(c1,c2,c3,c4) (((c1)<<24)|((c2)<<16)|((c3)<<8)|(c4)) +#else /*ifdef __cplusplus */ +inline unsigned long get_long(const void *buf) +{ + unsigned char *ptr = (unsigned char *) buf; + + return (*ptr << 24) | (*(++ptr) << 16) | (*(++ptr) << 8) | + *(++ptr); +} + +inline signed long get_slong(const void *buf) +{ + unsigned long val = get_long(buf); + + if (val > 0x7FFFFFFF) + return ((signed long) (val & 0x7FFFFFFF)) - 0x80000000; + else + return val; +} + +inline unsigned long get_treble(const void *buf) +{ + unsigned char *ptr = (unsigned char *) buf; + + return (*ptr << 16) | (*(++ptr) << 8) | *(++ptr); +} + +inline signed long get_streble(const void *buf) +{ + unsigned long val = get_treble(buf); + + if (val > 0x7FFFFF) + return ((signed long) (val & 0x7FFFFF)) - 0x800000; + else + return val; +} + +inline int get_short(const void *buf) +{ + unsigned char *ptr = (unsigned char *) buf; + + return (*ptr << 8) | *(++ptr); +} + +inline signed short get_sshort(const void *buf) +{ + unsigned short val = get_short(buf); + + if (val > 0x7FFF) + return ((signed short) (val & 0x7FFF)) - 0x8000; + else + return val; +} + +inline int get_byte(const void *buf) +{ + return *((unsigned char *) buf); +} + +inline signed char get_sbyte(const void *buf) +{ + unsigned char val = get_byte(buf); + + if (val > 0x7F) + return ((signed char) (val & 0x7F)) - 0x80; + else + return val; +} + +inline void set_long(void *buf, const unsigned long val) +{ + unsigned char *ptr = (unsigned char *) buf; + + *ptr = (unsigned char) ((val >> 24) & 0xff); + *(++ptr) = (unsigned char) ((val >> 16) & 0xff); + *(++ptr) = (unsigned char) ((val >> 8) & 0xff); + *(++ptr) = (unsigned char) (val & 0xff); +} + +inline void set_slong(void *buf, const signed long val) +{ + unsigned long uval; + + if (val < 0) { + uval = (val + 0x80000000); + uval |= 0x80000000; + } else + uval = val; + set_long(buf, uval); +} + +inline void set_treble(void *buf, const unsigned long val) +{ + unsigned char *ptr = (unsigned char *) buf; + + *ptr = (unsigned char) ((val >> 16) & 0xff); + *(++ptr) = (unsigned char) ((val >> 8) & 0xff); + *(++ptr) = (unsigned char) (val & 0xff); +} + +inline void set_streble(void *buf, const signed long val) +{ + unsigned long uval; + + if (val < 0) { + uval = (val + 0x800000); + uval |= 0x800000; + } else + uval = val; + set_treble(buf, uval); +} + +inline void set_short(void *buf, const int val) +{ + unsigned char *ptr = (unsigned char *) buf; + + *ptr = (val >> 8) & 0xff; + *(++ptr) = val & 0xff; +} + +inline void set_sshort(void *buf, const signed short val) +{ + unsigned short uval; + + if (val < 0) { + uval = (val + 0x8000); + uval |= 0x8000; + } else + uval = val; + set_treble(buf, uval); +} + +inline void set_byte(void *buf, const int val) +{ + *((unsigned char *) buf) = val; +} + +inline void set_sbyte(void *buf, const signed char val) +{ + unsigned char uval; + + if (val < 0) { + uval = (val + 0x80); + uval |= 0x80; + } else + uval = val; + set_byte(buf, uval); +} + +inline struct tm *getBufTm(struct tm *t, const void *buf, int setTime) +{ + unsigned short int d = get_short(buf); + + t->tm_year = (d >> 9) + 4; + t->tm_mon = ((d >> 5) & 15) - 1; + t->tm_mday = d & 31; + + if (setTime) { + t->tm_hour = 0; + t->tm_min = 0; + t->tm_sec = 0; + } + + t->tm_isdst = -1; + + mktime(t); + + return t; +} + +inline void setBufTm(void *buf, const struct tm *t) +{ + set_short(buf, + ((t->tm_year - 4) << 9) | ((t->tm_mon + + 1) << 5) | t->tm_mday); +} + +inline unsigned long char4(char c1, char c2, char c3, char c4) +{ + return (c1 << 24) | (c2 << 16) | (c3 << 8) | c4; +} + +#endif /*__cplusplus*/ +#endif /* _PILOT_MACROS_H_ */ diff --git a/pilot-link/pi-source.h b/pilot-link/pi-source.h new file mode 100644 index 000000000..e69de29bb -- 2.30.2